Analysis of Cell Technology¶

3 competing cell technologies may claim marketshare in future; Bifacial PERC, bifacial SHJ, and Bifacial TOPCon. Each design has different efficiency and a different silver intensity. This analysis seeks compare these technologies on a mass and energy basis. A psuedo global deployment projection hitting 100% RE targets in 2050 is used so that silver demand can be evaluated at the global level.

Make 4+ scenarios

  1. All PERC
  2. All SHJ
  3. All TOPCon
  4. Realistic blend / ITRPV numbers from Martin Springer or Jarett Zuboy – DURAMat tech scounting report
  5. All of the above and turn Bifacial ON/OFF

We will use the silver intensity and module efficiency projections from:

Zhang, Yuchao, Moonyong Kim, Li Wang, Pierre Verlinden, and Brett Hallam. 2021. “Design Considerations for Multi-Terawatt Scale Manufacturing of Existing and Future Photovoltaic Technologies: Challenges and Opportunities Related to Silver, Indium and Bismuth Consumption.” Energy & Environmental Science. https://doi.org/10.1039/D1EE01814K. 

and

Gervais, Estelle, Shivenes Shammugam, Lorenz Friedrich, and Thomas Schlegl. 2021. “Raw Material Needs for the Large-Scale Deployment of Photovoltaics – Effects of Innovation-Driven Roadmaps on Material Constraints until 2050.” Renewable and Sustainable Energy Reviews 137 (March): 110589. https://doi.org/10.1016/j.rser.2020.110589.
In [1]:
import numpy as np
import pandas as pd
import os,sys
from pathlib import Path
import matplotlib.pyplot as plt

plt.rcParams.update({'font.size': 18})
#plt.rcParams['figure.figsize'] = (10, 6)

cwd = os.getcwd() #grabs current working directory

testfolder = str(Path().resolve().parent.parent / 'PV_ICE' / 'TEMP' / 'CellTechCompare')
inputfolder = str(Path().resolve().parent.parent / 'PV_ICE' / 'TEMP')
baselinesfolder = str(Path().resolve().parent.parent /'PV_ICE' / 'baselines')
supportMatfolder = str(Path().resolve().parent.parent / 'PV_ICE' / 'baselines' / 'SupportingMaterial')

if not os.path.exists(testfolder):
    os.makedirs(testfolder)

Data Preparation¶

Bring in the data from Zhang et al 2021 and Gervais et al 2021.

In [2]:
lit_celltech = pd.read_excel(os.path.join(supportMatfolder,'CellTechCompare','PERCvSHJvTOPCon-LitData.xlsx'), sheet_name='Sheet2',
                             header=[0,1,2], index_col=0)
In [3]:
lit_celltech.columns.get_level_values
Out[3]:
<bound method MultiIndex.get_level_values of MultiIndex([('Zhang et al 2021 (hallam)',   'PERC',  'ModuleEff'),
            ('Zhang et al 2021 (hallam)',   'PERC', 'Ag_mgpcell'),
            ('Zhang et al 2021 (hallam)',    'SHJ',  'ModuleEff'),
            ('Zhang et al 2021 (hallam)',    'SHJ', 'Ag_mgpcell'),
            ('Zhang et al 2021 (hallam)', 'TOPCon',  'ModuleEff'),
            ('Zhang et al 2021 (hallam)', 'TOPCon', 'Ag_mgpcell')],
           names=[None, None, 'year'])>
In [4]:
#Zhang et al Table 2 gives cell size assumptions 166mm cells
cell_size_m2 = np.square(0.166)
In [5]:
#calculate silver use per meter squared for each tech
zhang_perc_Ag_gpm2 = lit_celltech['Zhang et al 2021 (hallam)']['PERC']['Ag_mgpcell']/1000/cell_size_m2 #creates series
zhang_shj_Ag_gpm2 = lit_celltech['Zhang et al 2021 (hallam)']['SHJ']['Ag_mgpcell']/1000/cell_size_m2
zhang_topcon_Ag_gpm2 = lit_celltech['Zhang et al 2021 (hallam)']['TOPCon']['Ag_mgpcell']/1000/cell_size_m2

Gervais et al 2021 also project silver use, but through 2050. We wil use Zhang et al silver intensity through 2030, then a futher decrease from Gervais et al to 2050. There is no projection of TOPCon from Gervais et al, so we will assume a similar magnitude of continued decrease.

In [6]:
lit_celltech.loc[2030]
Out[6]:
                                   year      
Zhang et al 2021 (hallam)  PERC    ModuleEff     24.5
                                   Ag_mgpcell    57.0
                           SHJ     ModuleEff     25.3
                                   Ag_mgpcell    99.0
                           TOPCon  ModuleEff     25.0
                                   Ag_mgpcell    95.0
Name: 2030, dtype: float64
In [7]:
Gervais_perc_2050 = pd.Series({2050:40}) #mg/cell
Gervais_shj_2050 = pd.Series({2050:80}) #mg/cell
guess_topcon_2050 = pd.Series({2050:(95-18)}) # mg/cell 99-80 = 19, 57-40 = 17, guess further 18mg decrease
#assuming the same cell size as Zhang et al (it isn't specified in Gervais)
Gervais_perc_2050_gpm2 = Gervais_perc_2050/1000/cell_size_m2
Gervais_shj_2050_gpm2 = Gervais_shj_2050/1000/cell_size_m2
guess_topcon_2050_gpm2 = guess_topcon_2050/1000/cell_size_m2
In [8]:
perc_Ag_gpm2 = pd.concat([zhang_perc_Ag_gpm2.loc[:2049], Gervais_perc_2050_gpm2])
shj_Ag_gpm2 = pd.concat([zhang_shj_Ag_gpm2.loc[:2049], Gervais_shj_2050_gpm2])
topcon_Ag_gpm2 = pd.concat([zhang_topcon_Ag_gpm2.loc[:2049], guess_topcon_2050_gpm2])
In [9]:
#filled projections 2020 through 2050
perc_Ag_gpm2.interpolate(inplace=True)
shj_Ag_gpm2.interpolate(inplace=True)
topcon_Ag_gpm2.interpolate(inplace=True)

Now lets use Zhang et al's projections of efficiency increases. These are reasonably ambitious, achieving ~25% by 2030, but PV is usually an overachiever. We will hold efficiency constant after 2030.

In [10]:
zhang_perc_modeff = lit_celltech['Zhang et al 2021 (hallam)']['PERC']['ModuleEff']
zhang_shj_modeff = lit_celltech['Zhang et al 2021 (hallam)']['SHJ']['ModuleEff']
zhang_topcon_modeff = lit_celltech['Zhang et al 2021 (hallam)']['TOPCon']['ModuleEff']
In [11]:
zhang_perc_modeff.interpolate(inplace=True)
zhang_shj_modeff.interpolate(inplace=True)
zhang_topcon_modeff.interpolate(inplace=True)
In [12]:
modeffs = pd.concat([zhang_perc_modeff,zhang_shj_modeff,zhang_topcon_modeff], axis=1)
modeffs.columns=['PERC','SHJ','TOPCon']
Aguse = pd.concat([perc_Ag_gpm2,shj_Ag_gpm2,topcon_Ag_gpm2], axis=1)
Aguse.columns=['PERC','SHJ','TOPCon']

#print for use in other journals
modeffs.to_csv(os.path.join(supportMatfolder, 'output-celltech-modeffimprovements.csv'))
Aguse.to_csv(os.path.join(supportMatfolder, 'output-celltech-Agusageimprovements.csv'))
In [13]:
plt.plot(modeffs.index, modeffs['PERC'], color='#0079C2')
plt.plot(modeffs.index, modeffs['SHJ'], color='#F7A11A', ls='--')
plt.plot(modeffs.index, modeffs['TOPCon'], color='#5D9732', ls='-.')

plt.legend(modeffs.columns)
plt.title('Module Efficiency over Time')
plt.ylabel('Module Efficiency [%]')
#plt.rc('font', size=20) #controls default text size
#plt.rc('axes', titlesize=10) #fontsize of the title
#plt.rc('axes', labelsize=10) #fontsize of the x and y labels
#plt.rc('xtick', labelsize=10) #fontsize of the x tick labels
#plt.rc('ytick', labelsize=10) #fontsize of the y tick labels
#plt.rc('legend', fontsize=10) #fontsize of the legend
#plt.show()
Out[13]:
Text(0, 0.5, 'Module Efficiency [%]')
In [14]:
plt.plot(Aguse.index, Aguse['PERC'], color='#0079C2')
plt.plot(Aguse.index, Aguse['SHJ'], color='#F7A11A', ls='--')
plt.plot(Aguse.index, Aguse['TOPCon'], color='#5D9732', ls='-.')
plt.legend(Aguse.columns)
plt.title('Silver Use over time')
plt.ylabel('Silver Intensity [g/m2]')
#plt.rc('font', size=20) #controls default text size
#plt.rc('axes', titlesize=10) #fontsize of the title
#plt.rc('axes', labelsize=10) #fontsize of the x and y labels
#plt.rc('xtick', labelsize=10) #fontsize of the x tick labels
#plt.rc('ytick', labelsize=10) #fontsize of the y tick labels
#plt.rc('legend', fontsize=10) #fontsize of the legend
plt.show()
In [15]:
Aguse.to_csv(os.path.join(testfolder,'ag_gpm2_bytech.csv'))

One important aspect of these technologies is bifaciality. Each has a different bifaciality factor, and they are not expected to increase substantially with time (ITRPV 2022). We plan to explore monofacial and bifacial modules of these technologies (for example residential vs utility). We will use a static inventory of bifacial factors.

In [16]:
bifiFactors = {'PERC':0.7,
              'SHJ':0.9,
              'TOPCon':0.8} # ITRPV 2022, Fig. 58
In [17]:
#PV ICE currently set up to read in a csv of bifi factors, so generate files to read in 
idx_temp = pd.RangeIndex(start=2050,stop=2101,step=1) #create the index
df_temp = pd.DataFrame(index=idx_temp, columns=['bifi'], dtype=float)
bifi_perc = df_temp.copy()
bifi_perc['bifi'] = bifiFactors['PERC']
bifi_shj = df_temp.copy()
bifi_shj['bifi'] = bifiFactors['SHJ']
bifi_topcon = df_temp.copy()
bifi_topcon['bifi'] = bifiFactors['TOPCon']
In [18]:
bifi_perc.to_csv(path_or_buf=os.path.join(testfolder,'bifi_perc.csv'), index_label='Year')
bifi_shj.to_csv(path_or_buf=os.path.join(testfolder,'bifi_shj.csv'), index_label='Year')
bifi_topcon.to_csv(path_or_buf=os.path.join(testfolder,'bifi_topcon.csv'), index_label='Year')
In [19]:
bifi_perc_path = os.path.join(testfolder,'bifi_perc.csv')
bifi_shj_path = os.path.join(testfolder,'bifi_shj.csv')
bifi_topcon_path = os.path.join(testfolder,'bifi_topcon.csv')

To create a blended scenario, we will use the ITRPV 2022 cell market share projection through 2030, and then keep it constant through 2050.

In [20]:
#insert data from Jarett here
itrpv_celltech_marketshare = pd.read_csv(os.path.join(supportMatfolder,'CellTechCompare','ITRPV_celltech_marketshare.csv'), index_col=0)
In [21]:
itrpv_celltech_marketshare.columns
itrpv_celltech_marketshare.index
#there are more cell techs here than I need - I'm not currently concerned with n-type vs p-type
#the marketshares of "n-type back contact", "n-type other", "tandem si-based" are small and outside scope of study
#remove and renormalize.
Out[21]:
Int64Index([2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
            2027, 2028, 2029, 2030, 2031, 2032],
           dtype='int64', name='year')
In [22]:
#subset for desired techs
celltech_marketshare_sub_raw = itrpv_celltech_marketshare.loc[2020:].filter(regex=('PERC|TOPCon|SHJ')) 
#interpolate to fill gaps
celltech_marketshare_sub_raw.interpolate(inplace=True, limit_direction='both')
#renormalize
celltech_marketshare_sub_raw['temp_sum'] = celltech_marketshare_sub_raw.iloc[:,[0,1,2,3]].sum(axis=1)
celltech_marketshare_sub_raw['scale'] = 1/celltech_marketshare_sub_raw['temp_sum'] #create scaling factor
celltech_marketshare_scaled = celltech_marketshare_sub_raw.iloc[:,[0,1,2,3]]*celltech_marketshare_sub_raw.loc[:,['scale']].values
#celltech_marketshare_scaled.sum(axis=1) # test check that everything adds to 1
In [23]:
celltech_marketshare_scaled.index
Out[23]:
Int64Index([2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030,
            2031, 2032],
           dtype='int64', name='year')
In [24]:
plt.plot([],[],color='#0079C2', label='PERC')
plt.plot([],[],color='#5D9732', label='TOPCon (p-type)')
plt.plot([],[],color='#8CC63F', label='TOPCon (n-type)')
plt.plot([],[],color='#F7A11A', label='SHJ')
#plt.plot([],[],color='red', label='Cell')

plt.stackplot(celltech_marketshare_scaled.index,
              celltech_marketshare_scaled['p-type (PERC)'],
              celltech_marketshare_scaled['p-type (TOPCon)'],
              celltech_marketshare_scaled['n-type (TOPCon)'],
              celltech_marketshare_scaled['n-type (SHJ)'],
              colors = ['#0079C2','#5D9732','#8CC63F','#F7A11A'])

plt.title('Market Share Cell Type: Blended Projection')
plt.ylabel('Market Share [fraction]')
#plt.xlim(1995,2022)
#plt.legend(loc='lower center')
plt.rc('xtick', labelsize=16) #fontsize of the x tick labels
plt.show()
In [25]:
celltech_marketshare_scaled['TOPCon'] = celltech_marketshare_scaled.filter(like='TOPCon').sum(axis=1)

Other Assumptions:

  • silicon wafer thickness is identical, and improvements are identical
  • glass-glass module package for bifacial using 2.5mm glass for both
  • module manufacturing energy is identical (until we get better data)
  • degradation rates between the technologies are identical (until we get better data)
  • Weibull Failure probabilities are identical between technologies (until we get better data)
  • No ciruclarity
In [20]:
#glass-glass package mass per area calculation
#ITRPV 2022 Figs 36 and 38, we are assuming that the front and back glass heave equal thickness of 2.5mm
density_glass = 2500*1000 # g/m^3 
glassperm2 = (2.5/1000)* 2 * density_glass
print('The mass per module area of glass is '+str(glassperm2)+' g/m^2')
The mass per module area of glass is 12500.0 g/m^2

Pull in deployment projection. This deployment is based on the Solar Futures report, but has been modified to be more reasonable annual deployment schedule (i.e. manufacturing ramps up). However, this does not achieve 95% RE by 2035, but it does achieve 100% RE in 2050.

In [2]:
sf_reeds_alts = pd.read_excel(os.path.join(supportMatfolder,'SF_reeds_alternates.xlsx'),index_col=0)
In [3]:
sf_reeds = sf_reeds_alts.loc[2023:2050,['MW']]
In [4]:
plt.plot(sf_reeds)
Out[4]:
[<matplotlib.lines.Line2D at 0x23774464f10>]
In [6]:
sf_reeds['rolling'] = sf_reeds.rolling(window=5).mean()
In [7]:
plt.plot(sf_reeds)
Out[7]:
[<matplotlib.lines.Line2D at 0x23774bad3a0>,
 <matplotlib.lines.Line2D at 0x23774bad430>]
In [29]:
#try sorting the Reeds Deployment to be in ascending order
sf_reeds['MW'].values.sort() #this sorts the column values in place
In [30]:
sf_reeds['TW_cum'] = sf_reeds['MW'].cumsum()/1e6
In [31]:
fig, ax1 = plt.subplots()

ax1.plot(sf_reeds['MW'])
ax1.set_ylabel('Annual Deployments [MW]', color='blue')

ax2 = ax1.twinx()
ax2.plot(sf_reeds['TW_cum'], color='orange')
ax2.set_ylabel('Cumulative Capacity [TW]', color='orange')

#ax1.rc('xtick', labelsize=10) #fontsize of the x tick labels
#ax1.rc('ytick', labelsize=18) #fontsize of the y tick labels

plt.legend(['Cumulative Capacity'])
plt.show()
In [32]:
sf_reeds.loc[2030]
Out[32]:
MW        29613.993350
TW_cum        0.207411
Name: 2030.0, dtype: float64
In [33]:
sf_reeds.loc[2050]
Out[33]:
MW        87426.894740
TW_cum        1.523311
Name: 2050.0, dtype: float64
In [34]:
#historical 2020-2022 from Wood Mac
history = sf_reeds_alts.loc[2020:2022,['Historically annual']]
history.columns=['MW']
projection = sf_reeds[['MW']]
newdeploymentcurve = pd.concat([history,projection],axis=0)
In [35]:
#modify projection to be closer to global scale by x10
newdeploymentcurve_global = newdeploymentcurve*10
In [36]:
newdeploymentcurve_global['TW_cum'] = newdeploymentcurve_global['MW'].cumsum()/1e6
newdeploymentcurve_global.to_csv(os.path.join(testfolder,'deploymentCurve_global.csv'))
In [37]:
fig, ax1 = plt.subplots()

ax1.plot(newdeploymentcurve_global['MW']/1000, color='blue')
ax1.set_ylabel('Annual Deployments [GW]', color='blue')
#ax1.set_ylim(0, 90)
ax1.set_yticks(range(0,901,100))
ax1.set_xlim(2020,2050)


ax2 = ax1.twinx()
ax2.plot(newdeploymentcurve_global['TW_cum'], color='orange')
ax2.set_ylabel('Cumulative Capacity [TW]', color='orange')
ax2.set_ylim(0, 16)

#plt.legend(['Cumulative Capacity'])
plt.rc('font', size=16) #controls default text size
plt.show()

Scenario Creation¶

In [23]:
#creating scenarios for identical power and identical area deployed
scennames = ['PERC_p','SHJ_p','TOPCon_p', 'PERC_a','SHJ_a','TOPCon_a'] #add later Blend and bifi on/off
MATERIALS = ['glass','silver','silicon', 'copper', 'aluminium_frames'] #'encapsulant', 'backsheet',
moduleFile_m = os.path.join(baselinesfolder, 'baseline_modules_mass_US.csv')
moduleFile_e = os.path.join(baselinesfolder, 'baseline_modules_energy.csv')
In [24]:
#load in a baseline and materials for modification
import PV_ICE

sim1 = PV_ICE.Simulation(name='sim1', path=testfolder)
for scen in scennames:
    sim1.createScenario(name=scen, massmodulefile=moduleFile_m, energymodulefile=moduleFile_e)
    for mat in range (0, len(MATERIALS)):
        matbaseline_m = os.path.join(baselinesfolder,'baseline_material_mass_'+MATERIALS[mat]+'.csv')
        matbaseline_e = os.path.join(baselinesfolder,'baseline_material_energy_'+MATERIALS[mat]+'.csv')
        sim1.scenario[scen].addMaterial(MATERIALS[mat], massmatfile=matbaseline_m, energymatfile=matbaseline_e)
path = C:\Users\hmirletz\Documents\GitHub\PV_ICE\PV_ICE\TEMP\CellTechCompare

Modify the all one tech scenarios Scenarios:

Module level

  • trim to 2020-2050
  • no circularity
  • deployment projection
  • module eff

material level

  • glass per m2
  • silver per m2
In [40]:
#trim to 2020-2050, this trims module and materials
sim1.trim_Years(startYear=2020, endYear=2050)
Data trimed, years now encompass  2020  to  2050
Data trimed, years now encompass  2020  to  2050
Data trimed, years now encompass  2020  to  2050
Data trimed, years now encompass  2020  to  2050
Data trimed, years now encompass  2020  to  2050
Data trimed, years now encompass  2020  to  2050
In [41]:
#no circularity
sim1.scenMod_noCircularity()
In [42]:
#deployment projection
#NEED TO PULL IN DEPLOYMENT PROJECTION

for scen in scennames:
    sim1.scenario[scen].dataIn_m.loc[0:len(newdeploymentcurve.index-1),'new_Installed_Capacity_[MW]'] = newdeploymentcurve_global['MW'].values
In [43]:
#module eff
#modeffs
for scen in scennames:
    sim1.scenario[scen].dataIn_m.loc[0:len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values
In [44]:
#glass modify
for scen in scennames:
    sim1.scenario[scen].material['glass'].matdataIn_m['mat_massperm2'] = glassperm2
In [45]:
#silver modify
#Aguse
for scen in scennames:
    sim1.scenario[scen].material['silver'].matdataIn_m.loc[0:len(Aguse.index-1),'mat_massperm2'] = Aguse.filter(like=str(scen[0:3])).values

Check to make sure the modifications took.

In [46]:
sim1.scenario['SHJ_a'].dataIn_m.head(10)
Out[46]:
year new_Installed_Capacity_[MW] mod_eff mod_reliability_t50 mod_reliability_t90 mod_degradation mod_lifetime mod_MFG_eff mod_Repair mod_MerchantTail ... mod_EOL_pg1_landfill mod_EOL_pg2_stored mod_EOL_pg3_reMFG mod_EOL_pg4_recycled mod_EOL_reMFG_yield mod_EOL_sp_reMFG_recycle mod_EOL_pb1_landfill mod_EOL_pb2_stored mod_EOL_pb3_reMFG mod_EOL_pb4_recycled
0 2020 199145.501006 23.50 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
1 2021 240948.044652 23.68 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
2 2022 218931.470533 23.86 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
3 2023 235967.289600 24.04 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
4 2024 235967.289600 24.22 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
5 2025 242364.159700 24.40 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
6 2026 242364.159700 24.58 33.0 38.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
7 2027 262583.013200 24.76 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
8 2028 262583.013200 24.94 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
9 2029 296139.933500 25.12 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0

10 rows × 22 columns

In [47]:
sim1.scenario['SHJ_p'].material['silver'].matdataIn_m.head()
Out[47]:
year mat_virgin_eff mat_massperm2 mat_MFG_eff mat_MFG_scrap_Recycled mat_MFG_scrap_Recycling_eff mat_MFG_scrap_Recycled_into_HQ mat_MFG_scrap_Recycled_into_HQ_Reused4MFG mat_PG3_ReMFG_target mat_ReMFG_yield mat_PG4_Recycling_target mat_Recycling_yield mat_EOL_Recycled_into_HQ mat_EOL_RecycledHQ_Reused4MFG
0 2020 75.0 7.911163 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 2021 75.0 7.479315 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 2022 75.0 7.047467 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 2023 75.0 6.615619 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 2024 75.0 6.183771 80.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
In [48]:
sim1.scenario['SHJ_p'].material['silicon'].matdataIn_e.head()
Out[48]:
year e_mat_extraction e_mat_MFG e_mat_MFG_fuelfraction e_mat_MFGScrap_LQ e_mat_MFGScrap_HQ e_mat_Landfill e_mat_Landfill_fuelfraction e_mat_EoL_ReMFG_clean e_mat_Recycled_LQ e_mat_Recycled_HQ e_mat_Recycled_HQ_fuelfraction
0 2020 0.0062 169.06 0.22 24.5 600.0 0.09 0.0 0.4 1.6 138.38 0.20
1 2021 0.0062 170.73 0.21 24.5 600.0 0.09 0.0 0.4 1.6 143.04 0.19
2 2022 0.0062 169.05 0.20 24.5 600.0 0.09 0.0 0.4 1.6 144.33 0.19
3 2023 0.0062 168.80 0.20 24.5 600.0 0.09 0.0 0.4 1.6 144.20 0.19
4 2024 0.0062 169.09 0.20 24.5 600.0 0.09 0.0 0.4 1.6 144.60 0.19

Run Simulations¶

Option 1: Compare with Idential Power Installed¶

In [49]:
scennames_p = ['PERC_p','SHJ_p','TOPCon_p']
bifipaths = [bifi_perc_path,bifi_shj_path,bifi_topcon_path]
In [50]:
#option 1, install identical power
sim1.calculateFlows(scenarios='PERC_p', bifacialityfactors=bifi_perc_path)
sim1.calculateFlows(scenarios='SHJ_p', bifacialityfactors=bifi_shj_path)
sim1.calculateFlows(scenarios='TOPCon_p', bifacialityfactors=bifi_topcon_path)

perc_p_yearly, perc_p_cum = sim1.aggregateResults(scenarios='PERC_p')
shj_p_yearly, shj_p_cum = sim1.aggregateResults(scenarios='SHJ_p')
topcon_p_yearly, topcon_p_cum = sim1.aggregateResults(scenarios='TOPCon_p')
>>>> Calculating Material Flows <<<<

Working on Scenario:  PERC_p
********************
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  PERC_p
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
>>>> Calculating Material Flows <<<<

Working on Scenario:  SHJ_p
********************
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  SHJ_p
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
>>>> Calculating Material Flows <<<<

Working on Scenario:  TOPCon_p
********************
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  TOPCon_p
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon

Option 2: Compare with Idential Area Installed¶

In [51]:
scennames_a = ['PERC_a','SHJ_a','TOPCon_a']
bifipaths = [bifi_perc_path,bifi_shj_path,bifi_topcon_path]
In [52]:
#Calculate Area deployed based on PERC and modified SF projection above
idx_temp = Aguse.index #grab matching index
area_deploy = pd.DataFrame(index=idx_temp, dtype=float) #create an empty DF
area_deploy['Area'] = sim1.scenario['PERC_p'].dataOut_m['Area'].values
area_deploy.head()
Out[52]:
Area
2020 8.163039e+08
2021 9.803443e+08
2022 8.842215e+08
2023 9.460754e+08
2024 9.392256e+08
In [53]:
#option 2, install identical area
sim1.calculateFlows(scenarios='PERC_a', bifacialityfactors=bifi_perc_path, installByArea=list(area_deploy['Area']))
sim1.calculateFlows(scenarios='SHJ_a', bifacialityfactors=bifi_shj_path,  installByArea=list(area_deploy['Area']))
sim1.calculateFlows(scenarios='TOPCon_a', bifacialityfactors=bifi_topcon_path,  installByArea=list(area_deploy['Area']))

perc_a_yearly, perc_a_cum = sim1.aggregateResults(scenarios='PERC_a')
shj_a_yearly, shj_a_cum = sim1.aggregateResults(scenarios='SHJ_a')
topcon_a_yearly, topcon_a_cum = sim1.aggregateResults(scenarios='TOPCon_a')
>>>> Calculating Material Flows <<<<

Working on Scenario:  PERC_a
********************
Calculating installed capacity based on installed Area
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  PERC_a
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
>>>> Calculating Material Flows <<<<

Working on Scenario:  SHJ_a
********************
Calculating installed capacity based on installed Area
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  SHJ_a
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
>>>> Calculating Material Flows <<<<

Working on Scenario:  TOPCon_a
********************
Calculating installed capacity based on installed Area
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  TOPCon_a
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
In [54]:
all_results_yearly, all_results_cum = sim1.aggregateResults()
all_results_yearly.columns
Out[54]:
Index(['VirginStock_glass_sim1_PERC_p_[Tonnes]',
       'VirginStock_silver_sim1_PERC_p_[Tonnes]',
       'VirginStock_silicon_sim1_PERC_p_[Tonnes]',
       'VirginStock_Module_sim1_PERC_p_[Tonnes]',
       'WasteAll_glass_sim1_PERC_p_[Tonnes]',
       'WasteAll_silver_sim1_PERC_p_[Tonnes]',
       'WasteAll_silicon_sim1_PERC_p_[Tonnes]',
       'WasteAll_Module_sim1_PERC_p_[Tonnes]',
       'WasteEOL_glass_sim1_PERC_p_[Tonnes]',
       'WasteEOL_silver_sim1_PERC_p_[Tonnes]',
       ...
       'ActiveCapacity_sim1_SHJ_p_[MW]',
       'DecommisionedCapacity_sim1_SHJ_p_[MW]',
       'ActiveCapacity_sim1_TOPCon_p_[MW]',
       'DecommisionedCapacity_sim1_TOPCon_p_[MW]',
       'ActiveCapacity_sim1_PERC_a_[MW]',
       'DecommisionedCapacity_sim1_PERC_a_[MW]',
       'ActiveCapacity_sim1_SHJ_a_[MW]',
       'DecommisionedCapacity_sim1_SHJ_a_[MW]',
       'ActiveCapacity_sim1_TOPCon_a_[MW]',
       'DecommisionedCapacity_sim1_TOPCon_a_[MW]'],
      dtype='object', length=114)

Compare Effective Capacity¶

In [55]:
activecapacity_yearly_TW = pd.DataFrame(all_results_yearly.filter(like='ActiveCapacity'))/1e6
activecapacity_yearly_TW_p = activecapacity_yearly_TW.filter(like='_p')
activecapacity_yearly_TW_a = activecapacity_yearly_TW.filter(like='_a')
In [56]:
plt.plot(activecapacity_yearly_TW_p.index, activecapacity_yearly_TW_p.iloc[:,[0]], color='#0079C2')
plt.plot(activecapacity_yearly_TW_p.index, activecapacity_yearly_TW_p.iloc[:,[1]], color='#F7A11A', ls='--')
plt.plot(activecapacity_yearly_TW_p.index, activecapacity_yearly_TW_p.iloc[:,[2]], color='#5D9732', ls='-.')
plt.legend(scennames_p)
plt.title('Identical Installed Power: Effective Capacity')
plt.ylabel('Effective Capacity [TW]')
Out[56]:
Text(0, 0.5, 'Effective Capacity [TW]')
In [57]:
plt.plot(activecapacity_yearly_TW_a.index, activecapacity_yearly_TW_a.iloc[:,[0]], color='#0079C2')
plt.plot(activecapacity_yearly_TW_a.index, activecapacity_yearly_TW_a.iloc[:,[1]], color='#F7A11A', ls='--')
plt.plot(activecapacity_yearly_TW_a.index, activecapacity_yearly_TW_a.iloc[:,[2]], color='#5D9732', ls='-.')
plt.legend(scennames_a)
plt.title('Identical Installed Area: Effective Capacity')
plt.ylabel('Effective Capacity [TW]')
Out[57]:
Text(0, 0.5, 'Effective Capacity [TW]')

Compare Area Deployed¶

In [58]:
#compile all energy out results
area_deployed=pd.DataFrame()
for scen in scennames:
    # add the scen name as a prefix for later filtering
    scen_area = sim1.scenario[scen].dataOut_m[['Cumulative_Active_Area']].add_prefix(str(scen+'_'))
    #concat into one large df
    area_deployed = pd.concat([area_deployed, scen_area], axis=1)

area_deployed.index = idx_temp
area_deployed.tail()
Out[58]:
PERC_p_Cumulative_Active_Area SHJ_p_Cumulative_Active_Area TOPCon_p_Cumulative_Active_Area PERC_a_Cumulative_Active_Area SHJ_a_Cumulative_Active_Area TOPCon_a_Cumulative_Active_Area
2046 4.786576e+10 4.551035e+10 4.648721e+10 4.786576e+10 4.786576e+10 4.786576e+10
2047 5.086479e+10 4.836112e+10 4.939884e+10 5.086479e+10 5.086479e+10 5.086479e+10
2048 5.383243e+10 5.118201e+10 5.227991e+10 5.383243e+10 5.383243e+10 5.383243e+10
2049 5.699941e+10 5.419233e+10 5.535445e+10 5.699941e+10 5.699941e+10 5.699941e+10
2050 6.012108e+10 5.715954e+10 5.838492e+10 6.012108e+10 6.012108e+10 6.012108e+10
In [59]:
plt.plot(area_deployed.index, area_deployed.iloc[:,[0]]/1e6, color='#0079C2')
plt.plot(area_deployed.index, area_deployed.iloc[:,[1]]/1e6, color='#F7A11A', ls='--')
plt.plot(area_deployed.index, area_deployed.iloc[:,[2]]/1e6, color='#5D9732', ls='-.')
plt.legend(scennames_p)
plt.title('Identical Installed Power: Cumulative Active Area')
plt.ylabel('Area [million m2]')
Out[59]:
Text(0, 0.5, 'Area [million m2]')
In [60]:
plt.plot(area_deployed.index, area_deployed.iloc[:,[3]]/1e6, color='#0079C2')
plt.plot(area_deployed.index, area_deployed.iloc[:,[4]]/1e6, color='#F7A11A', ls='--')
plt.plot(area_deployed.index, area_deployed.iloc[:,[5]]/1e6, color='#5D9732', ls='-.')
plt.legend(scennames_a)
plt.title('Identical Installed Area: Cumulative Active Area')
plt.ylabel('Area [million m$^2$]')
Out[60]:
Text(0, 0.5, 'Area [million m$^2$]')

Compare Silver Demand¶

In [61]:
sim1.plotMaterialComparisonAcrossScenarios(keyword='mat_Virgin_Stock', material='silver')
In [62]:
annual_demand_silver = all_results_yearly.filter(like='VirginStock_silver')
annual_demand_silver.columns=scennames
annual_demand_silver.to_csv(os.path.join(testfolder,'annual_demand_silver.csv'))
In [63]:
silver_demand_cum = pd.DataFrame(all_results_cum.filter(like='VirginStock_silver').loc[2050]).T
In [64]:
silver_demand_cum
silver_demand_cum.to_csv(os.path.join(testfolder,'Ag_demand_cum2050_allScens.csv'))
In [65]:
plt.bar(silver_demand_cum.columns, silver_demand_cum.loc[2050], tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Silver Demand by Scenario')
plt.ylabel('[Tonnes]')
plt.rc('xtick', labelsize=12) #fontsize of the x tick labels
In [66]:
silver_demand_cum
Out[66]:
VirginStock_silver_sim1_PERC_p_[Tonnes] VirginStock_silver_sim1_SHJ_p_[Tonnes] VirginStock_silver_sim1_TOPCon_p_[Tonnes] VirginStock_silver_sim1_PERC_a_[Tonnes] VirginStock_silver_sim1_SHJ_a_[Tonnes] VirginStock_silver_sim1_TOPCon_a_[Tonnes]
2050 146886.124908 267804.452857 252181.780974 146886.124908 281638.847956 259640.845021
In [67]:
all_results_yearly.loc[2050].filter(like='newInstalledCapacity') 
#FYI the area deployment doesn't overwrite the new installs column - do not trust those numbers!
Out[67]:
newInstalledCapacity_sim1_PERC_p_[MW]      874268.9474
newInstalledCapacity_sim1_SHJ_p_[MW]       874268.9474
newInstalledCapacity_sim1_TOPCon_p_[MW]    874268.9474
newInstalledCapacity_sim1_PERC_a_[MW]      874268.9474
newInstalledCapacity_sim1_SHJ_a_[MW]       874268.9474
newInstalledCapacity_sim1_TOPCon_a_[MW]    874268.9474
Name: 2050, dtype: float64
In [68]:
activecapacity = pd.DataFrame(all_results_yearly.loc[2050].filter(like='ActiveCapacity')).T/1e6
#activecapacity
newInstalledCap_TW = pd.DataFrame(all_results_yearly.loc[2050].filter(like='newInstalledCapacity')).T/1e6
newInstalledCap_TW
Out[68]:
newInstalledCapacity_sim1_PERC_p_[MW] newInstalledCapacity_sim1_SHJ_p_[MW] newInstalledCapacity_sim1_TOPCon_p_[MW] newInstalledCapacity_sim1_PERC_a_[MW] newInstalledCapacity_sim1_SHJ_a_[MW] newInstalledCapacity_sim1_TOPCon_a_[MW]
2050 0.874269 0.874269 0.874269 0.874269 0.874269 0.874269

Calculate mg/W over time

In [69]:
newInstalledCap_MW_annual = pd.DataFrame(all_results_yearly.filter(like='newInstalledCapacity'))
newInstalledCap_MW_annual.columns = scennames
In [70]:
annual_demand_silver_kg = annual_demand_silver*1000
ag_annual_mgpW = annual_demand_silver_kg/newInstalledCap_MW_annual #kg/MW = mg/W
ag_annual_mgpW.loc[2050]
Out[70]:
PERC_p       7.062816
SHJ_p       13.427981
TOPCon_p    13.200632
PERC_a       7.062816
SHJ_a       14.125632
TOPCon_a    13.595921
Name: 2050, dtype: float64
In [71]:
#silver_demand_cum #tonne
newInstalledCap_MW_annual_cum = newInstalledCap_MW_annual.cumsum()
silver_demand_cum.columns
Out[71]:
Index(['VirginStock_silver_sim1_PERC_p_[Tonnes]',
       'VirginStock_silver_sim1_SHJ_p_[Tonnes]',
       'VirginStock_silver_sim1_TOPCon_p_[Tonnes]',
       'VirginStock_silver_sim1_PERC_a_[Tonnes]',
       'VirginStock_silver_sim1_SHJ_a_[Tonnes]',
       'VirginStock_silver_sim1_TOPCon_a_[Tonnes]'],
      dtype='object')
In [72]:
agintensity_mgpW = silver_demand_cum*1000/newInstalledCap_MW_annual_cum.loc[2050] #kg/MW = mg/W
agintensity_mgpW
Out[72]:
PERC_a PERC_p SHJ_a SHJ_p TOPCon_a TOPCon_p VirginStock_silver_sim1_PERC_a_[Tonnes] VirginStock_silver_sim1_PERC_p_[Tonnes] VirginStock_silver_sim1_SHJ_a_[Tonnes] VirginStock_silver_sim1_SHJ_p_[Tonnes] VirginStock_silver_sim1_TOPCon_a_[Tonnes] VirginStock_silver_sim1_TOPCon_p_[Tonnes]
2050 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
In [73]:
plt.bar(agintensity_mgpW.columns[0:3], agintensity_mgpW.loc[2050][0:3], color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Average Silver Demand per Capacity')
plt.ylabel('mg/W')
Out[73]:
Text(0, 0.5, 'mg/W')

Energy Data Org¶

In [74]:
#compile all energy out results
energy_mod=pd.DataFrame()
for scen in scennames:
    # add the scen name as a prefix for later filtering
    scende = sim1.scenario[scen].dataOut_e.loc[0:30].add_prefix(str(scen+'_'))
    #concat into one large df
    energy_mod = pd.concat([energy_mod, scende], axis=1)

energy_mod.tail()
Out[74]:
PERC_p_mod_MFG PERC_p_mod_Install PERC_p_mod_OandM PERC_p_mod_Repair PERC_p_mod_Demount PERC_p_mod_Store PERC_p_mod_Resell_Certify PERC_p_mod_ReMFG_Disassembly PERC_p_mod_Recycle_Crush PERC_p_e_out_annual_[Wh] ... TOPCon_a_mod_MFG TOPCon_a_mod_Install TOPCon_a_mod_OandM TOPCon_a_mod_Repair TOPCon_a_mod_Demount TOPCon_a_mod_Store TOPCon_a_mod_Resell_Certify TOPCon_a_mod_ReMFG_Disassembly TOPCon_a_mod_Recycle_Crush TOPCon_a_e_out_annual_[Wh]
26 1.015141e+13 2.846676e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.893346e+16 ... 1.015141e+13 2.846676e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.967769e+16
27 1.049319e+13 2.942517e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.009841e+16 ... 1.049319e+13 2.942517e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.088884e+16
28 1.049319e+13 2.942517e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.124680e+16 ... 1.049319e+13 2.942517e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.208280e+16
29 1.129815e+13 3.168245e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.247568e+16 ... 1.129815e+13 3.168245e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.336047e+16
30 1.129815e+13 3.168245e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.368309e+16 ... 1.129815e+13 3.168245e+10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.461584e+16

5 rows × 60 columns

In [75]:
energy_mat = pd.DataFrame()
for scen in scennames:
    for mat in MATERIALS:
        # add the scen name as a prefix for later filtering
        scenmatde = sim1.scenario[scen].material[mat].matdataOut_e.loc[0:30].add_prefix(str(scen+'_'+mat+'_'))
        #concat into one large df
        energy_mat = pd.concat([energy_mat, scenmatde], axis=1)

energy_mat.tail()
Out[75]:
PERC_p_glass_mat_extraction PERC_p_glass_mat_MFG_virgin PERC_p_glass_mat_MFGScrap_LQ PERC_p_glass_mat_MFGScrap_HQ PERC_p_glass_mat_Landfill PERC_p_glass_mat_EoL_ReMFG_clean PERC_p_glass_mat_Recycled_LQ PERC_p_glass_mat_Recycled_HQ PERC_p_silver_mat_extraction PERC_p_silver_mat_MFG_virgin ... TOPCon_a_silver_mat_Recycled_LQ TOPCon_a_silver_mat_Recycled_HQ TOPCon_a_silicon_mat_extraction TOPCon_a_silicon_mat_MFG_virgin TOPCon_a_silicon_mat_MFGScrap_LQ TOPCon_a_silicon_mat_MFGScrap_HQ TOPCon_a_silicon_mat_Landfill TOPCon_a_silicon_mat_EoL_ReMFG_clean TOPCon_a_silicon_mat_Recycled_LQ TOPCon_a_silicon_mat_Recycled_HQ
26 3.989364e+11 1.356148e+14 0.0 0.0 1.859261e+11 0.0 0.0 0.0 1.605243e+08 1.565112e+12 ... 0.0 0.0 2.939341e+10 2.408600e+14 0.0 0.0 4.070711e+10 0.0 0.0 0.0
27 4.123676e+11 1.401807e+14 0.0 0.0 2.176776e+11 0.0 0.0 0.0 1.626790e+08 1.586120e+12 ... 0.0 0.0 3.038301e+10 2.489692e+14 0.0 0.0 4.285404e+10 0.0 0.0 0.0
28 4.123676e+11 1.401807e+14 0.0 0.0 2.530008e+11 0.0 0.0 0.0 1.594292e+08 1.554435e+12 ... 0.0 0.0 3.038301e+10 2.489692e+14 0.0 0.0 4.392868e+10 0.0 0.0 0.0
29 4.440014e+11 1.509343e+14 0.0 0.0 3.042588e+11 0.0 0.0 0.0 1.681604e+08 1.639564e+12 ... 0.0 0.0 3.271377e+10 2.680683e+14 0.0 0.0 4.826380e+10 0.0 0.0 0.0
30 4.440014e+11 1.509343e+14 0.0 0.0 3.552260e+11 0.0 0.0 0.0 1.646614e+08 1.605448e+12 ... 0.0 0.0 3.271377e+10 2.680683e+14 0.0 0.0 4.980793e+10 0.0 0.0 0.0

5 rows × 144 columns

In [76]:
allenergy = pd.concat([energy_mod,energy_mat], axis=1)
allenergy.index=idx_temp

Graphing Energy Generation¶

In [77]:
energyGen = allenergy.filter(like='e_out_annual')
In [78]:
fig, ax1 = plt.subplots()

ax1.plot(energyGen)
#ax1.set_ylabel('Annual Deployments [MW]', color='blue')

#ax2 = ax1.twinx()
#ax2.plot(sf_reeds['TW_cum'], color='orange')
#ax2.set_ylabel('Cumulative Capacity [TW]', color='orange')
#ax1.set_yscale('log')

plt.legend(energyGen.columns)
plt.title('Annual Energy Generation')
plt.show()
In [79]:
energyGen_p = energyGen.filter(like='_p')/1e12
energyGen_a = energyGen.filter(like='_a')/1e12
In [80]:
#plt.plot(energyGen_p)#, color=['#006fa2','#ee005b','#734296'])
plt.plot(energyGen_p.index, energyGen_p.iloc[:,[0]], color='#0079C2')
plt.plot(energyGen_p.index, energyGen_p.iloc[:,[1]], color='#F7A11A', ls='--')
plt.plot(energyGen_p.index, energyGen_p.iloc[:,[2]], color='#5D9732', ls='-.')
plt.legend(scennames_p)
plt.title('Identical Power Installed: Annual Energy Generation')
plt.ylabel('Energy Generated [TWh]')
Out[80]:
Text(0, 0.5, 'Energy Generated [TWh]')
In [81]:
#plt.plot(energyGen_p)#, color=['#006fa2','#ee005b','#734296'])
plt.plot(energyGen_a.index, energyGen_a.iloc[:,[0]], color='#0079C2')
plt.plot(energyGen_a.index, energyGen_a.iloc[:,[1]], color='#F7A11A', ls='--')
plt.plot(energyGen_a.index, energyGen_a.iloc[:,[2]], color='#5D9732', ls='-.')
plt.legend(scennames_a)
plt.title('Identical Area Installed: Annual Energy Generation')
plt.ylabel('Energy Generated [TWh]')
Out[81]:
Text(0, 0.5, 'Energy Generated [TWh]')

Or as a bar plot

In [82]:
energyGen_cum = energyGen.cumsum()
energyGen_cum_2050 = energyGen_cum.loc[[2050]]
energyGen_cum_2050/1e12
energyGen_cum_2050.columns = scennames
energyGen_cum_2050
Out[82]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 2.922153e+17 2.976772e+17 2.949462e+17 2.922153e+17 3.130398e+17 3.036296e+17
In [83]:
plt.bar(energyGen_cum_2050.columns, energyGen_cum_2050.loc[2050]/1e12, 
        tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Energy Generated Cumulatively by Scenario')
plt.ylabel('[TWh]')
plt.rc('font', size=14) #controls default text size
plt.rc('xtick', labelsize=8) #fontsize of the x tick labels
In [84]:
energyGen_cum_2050_norm = energyGen_cum_2050/energyGen_cum_2050.loc[2050,'PERC_a']
plt.bar(energyGen_cum_2050_norm.columns, energyGen_cum_2050_norm.loc[2050], tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Energy Generated Cumulatively by Scenario - Normalized to PERC')
plt.ylabel('Energy Normalized')
plt.rc('font', size=14) #controls default text size
plt.rc('xtick', labelsize=8) #fontsize of the x tick labels
In [85]:
energyGen_cum_2050_norm
Out[85]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 1.0 1.018692 1.009346 1.0 1.071265 1.039061

Energy vs Silver Demand¶

In [86]:
energyGen_cum_2050.columns=silver_demand_cum.columns=scennames
whpag = (energyGen_cum_2050)/silver_demand_cum #Wh generated cumulative, per silver demand
normalizer = whpag.loc[2050,'PERC_a']
whpag/normalizer
Out[86]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 1.0 0.558735 0.587905 1.0 0.558708 0.587826
In [87]:
plt.bar(whpag.columns, whpag.loc[2050]/1e12, tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Energy Generated Cumulatively per Silver Demand Tonnes')
plt.ylabel('[TWh/tonnes]')
Out[87]:
Text(0, 0.5, '[TWh/tonnes]')
In [88]:
energyGen_cum_2050.columns=silver_demand_cum.columns=scennames
agpwh= silver_demand_cum/(energyGen_cum_2050) #Wh generated cumulative, per silver demand
normalizer = agpwh.loc[2050,'PERC_a']
agpwh_norm = agpwh/normalizer
agpwh_norm
Out[88]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 1.0 1.789758 1.700956 1.0 1.789843 1.701183
In [89]:
plt.bar(agpwh_norm.columns, agpwh_norm.loc[2050], tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Silver Demand Tonnes per energy generation, normalized')
plt.ylabel('[tonnes/TWh] Normalized')
Out[89]:
Text(0, 0.5, '[tonnes/TWh] Normalized')

Net Energy Calcs¶

In [90]:
#categorize the energy in values into lifecycle stages
mfg_energies = ['mod_MFG','mat_extraction','mat_MFG_virgin']
mfg_recycle_energies_LQ = ['mat_MFGScrap_LQ'] #LQ and HQ are separate becuase LQ is only LQ
mfg_recycle_energies_HQ = ['mat_MFGScrap_HQ'] #and HQ material is E_LQ + E_HQ
use_energies = ['mod_Install','mod_OandM','mod_Repair']
eol_energies = ['mat_Landfill','mod_Demount','mod_Store','mod_Resell_Certify']
eol_remfg_energies = ['mod_ReMFG_Disassmbly','mat_EoL_ReMFG_clean']
eol_recycle_energies_LQ = ['mod_Recycle_Crush','mat_Recycled_LQ']
eol_recycle_energies_HQ = ['mod_Recycle_Crush','mat_Recycled_HQ']

energy_demands_keys = [mfg_energies,mfg_recycle_energies_LQ,mfg_recycle_energies_HQ,use_energies,eol_energies,
                  eol_remfg_energies,eol_recycle_energies_LQ,eol_recycle_energies_HQ]
import itertools
energy_demands_flat = list(itertools.chain(*energy_demands_keys))
#energy_demands_flat
In [91]:
#select the non energy generation columns for all scenarios
energy_demands = allenergy.loc[:,~allenergy.columns.isin(energyGen.columns)] 
edemand_perc_p = energy_demands.filter(like='PERC_p')
edemand_shj_p = energy_demands.filter(like='SHJ_p')
edemand_topcon_p = energy_demands.filter(like='TOPCon_p')
edemand_perc_a = energy_demands.filter(like='PERC_a')
edemand_shj_a = energy_demands.filter(like='SHJ_a')
edemand_topcon_a = energy_demands.filter(like='TOPCon_a')
In [92]:
#for each scenario, create a cumulative total energy demand
for scen in scennames:
    colname = str(scen+'_e_demand_total')
    energy_demands[colname] = energy_demands.filter(like=scen).sum(axis=1)
C:\Users\hmirletz\AppData\Local\Temp\1\ipykernel_4328\1996546283.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  energy_demands[colname] = energy_demands.filter(like=scen).sum(axis=1)
C:\Users\hmirletz\AppData\Local\Temp\1\ipykernel_4328\1996546283.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  energy_demands[colname] = energy_demands.filter(like=scen).sum(axis=1)
C:\Users\hmirletz\AppData\Local\Temp\1\ipykernel_4328\1996546283.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  energy_demands[colname] = energy_demands.filter(like=scen).sum(axis=1)
C:\Users\hmirletz\AppData\Local\Temp\1\ipykernel_4328\1996546283.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  energy_demands[colname] = energy_demands.filter(like=scen).sum(axis=1)
C:\Users\hmirletz\AppData\Local\Temp\1\ipykernel_4328\1996546283.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  energy_demands[colname] = energy_demands.filter(like=scen).sum(axis=1)
In [93]:
energy_demands_annual = energy_demands.filter(like='e_demand_total')
yrlyedemand_perc_p = energy_demands_annual.filter(like='PERC_p')
yrlyedemand_shj_p = energy_demands_annual.filter(like='SHJ_p')
yrlyedemand_topcon_p = energy_demands_annual.filter(like='TOPCon_p')
yrlyedemand_perc_a = energy_demands_annual.filter(like='PERC_a')
yrlyedemand_shj_a = energy_demands_annual.filter(like='SHJ_a')
yrlyedemand_topcon_a = energy_demands_annual.filter(like='TOPCon_a')
In [94]:
#plt.plot(energy_demands_annual)
plt.plot(yrlyedemand_perc_p.index, yrlyedemand_perc_p/1e12, color='#0079C2')
plt.plot(yrlyedemand_shj_p.index, yrlyedemand_shj_p/1e12, color='#F7A11A', ls='--')
plt.plot(yrlyedemand_topcon_p.index, yrlyedemand_topcon_p/1e12, color='#5D9732', ls='-.')
plt.legend(scennames_p)
plt.title('Identical Power Installed:\n Annual Energy Demands for Manufacturing')
plt.ylabel('Energy Demand [TWh]')
plt.rc('font', size=14) #controls default text size
plt.rc('xtick', labelsize=18) #fontsize of the x tick labels
plt.show()
In [95]:
energy_demand_total_cum = energy_demands.filter(like='e_demand_total').cumsum()
energy_demand_total_cum_2050 = energy_demand_total_cum.loc[[2050]]
energy_demand_total_cum_2050.columns = scennames
In [96]:
energy_demand_total_cum_2050/1e12
Out[96]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 8036.094822 7673.841537 7832.934303 8036.094822 8071.137039 8065.416419
In [97]:
energy_demand_total_cum_2050/energy_demand_total_cum_2050.loc[2050,'PERC_p']
Out[97]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 1.0 0.954922 0.974719 1.0 1.004361 1.003649
In [98]:
plt.bar(energy_demand_total_cum_2050.columns, energy_demand_total_cum_2050.loc[2050]/1e12, tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Cumulative Manufacturing Energy 2020-2050')
plt.ylabel('[TWh]')
Out[98]:
Text(0, 0.5, '[TWh]')
In [99]:
energyGen_cum_2050/1e12
Out[99]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 292215.264217 297677.231772 294946.247994 292215.264217 313039.84857 303629.601861

Net Energy¶

In [100]:
net_energy_cum_2050 = (energyGen_cum_2050-energy_demand_total_cum_2050)/1e12
net_energy_cum_2050
Out[100]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2050 284179.169395 290003.390235 287113.313691 284179.169395 304968.711531 295564.185442
In [101]:
plt.bar(net_energy_cum_2050.columns, net_energy_cum_2050.loc[2050], tick_label=(scennames), color=['#0079C2','#F7A11A','#5D9732'])
plt.title('Net Energy Cumulatively 2020-2050')
plt.ylabel('[TWh]')
Out[101]:
Text(0, 0.5, '[TWh]')
In [102]:
energyGen.columns = energy_demands_annual.columns = scennames
netEnergyAnnual_TWh = (energyGen - energy_demands_annual)/1e12
In [103]:
round(netEnergyAnnual_TWh,0)
Out[103]:
PERC_p SHJ_p TOPCon_p PERC_a SHJ_a TOPCon_a
2020 192.0 203.0 198.0 192.0 213.0 203.0
2021 549.0 568.0 559.0 549.0 597.0 574.0
2022 911.0 936.0 923.0 911.0 983.0 949.0
2023 1277.0 1309.0 1293.0 1277.0 1375.0 1329.0
2024 1651.0 1690.0 1671.0 1651.0 1775.0 1717.0
2025 2028.0 2074.0 2051.0 2028.0 2179.0 2108.0
2026 2406.0 2459.0 2433.0 2406.0 2584.0 2501.0
2027 2804.0 2865.0 2835.0 2804.0 3010.0 2915.0
2028 3211.0 3279.0 3245.0 3211.0 3446.0 3337.0
2029 3652.0 3730.0 3691.0 3652.0 3920.0 3796.0
2030 4107.0 4194.0 4151.0 4107.0 4408.0 4270.0
2031 4620.0 4718.0 4669.0 4620.0 4959.0 4804.0
2032 5157.0 5265.0 5211.0 5157.0 5534.0 5362.0
2033 5865.0 5991.0 5929.0 5865.0 6298.0 6101.0
2034 6647.0 6788.0 6718.0 6647.0 7137.0 6914.0
2035 7496.0 7654.0 7576.0 7496.0 8048.0 7797.0
2036 8371.0 8546.0 8459.0 8371.0 8986.0 8707.0
2037 9270.0 9462.0 9367.0 9270.0 9950.0 9642.0
2038 10176.0 10385.0 10281.0 10176.0 10921.0 10584.0
2039 11143.0 11372.0 11259.0 11143.0 11960.0 11590.0
2040 12135.0 12382.0 12259.0 12135.0 13022.0 12621.0
2041 13131.0 13398.0 13265.0 13131.0 14090.0 13657.0
2042 14125.0 14410.0 14269.0 14125.0 15156.0 14691.0
2043 15189.0 15497.0 15344.0 15189.0 16299.0 15799.0
2044 16280.0 16608.0 16445.0 16280.0 17467.0 16932.0
2045 17407.0 17758.0 17584.0 17407.0 18677.0 18105.0
2046 18545.0 18916.0 18732.0 18545.0 19896.0 19287.0
2047 19696.0 20091.0 19895.0 19696.0 21131.0 20485.0
2048 20845.0 21260.0 21054.0 20845.0 22362.0 21679.0
2049 22043.0 22483.0 22264.0 22043.0 23648.0 22926.0
2050 23250.0 23713.0 23483.0 23250.0 24942.0 24182.0
In [104]:
fig, ax1 = plt.subplots()
#ax1.plot(netEnergyAnnual_TWh)


ax1.plot(netEnergyAnnual_TWh.index, netEnergyAnnual_TWh.iloc[:,[0]], color='#0079C2')
ax1.plot(netEnergyAnnual_TWh.index, netEnergyAnnual_TWh.iloc[:,[1]], color='#F7A11A', ls='--')
ax1.plot(netEnergyAnnual_TWh.index, netEnergyAnnual_TWh.iloc[:,[2]], color='#5D9732', ls='-.')


ax1.plot(netEnergyAnnual_TWh.index, netEnergyAnnual_TWh.iloc[:,[3]], color='#0079C2')
ax1.plot(netEnergyAnnual_TWh.index, netEnergyAnnual_TWh.iloc[:,[4]], color='#FFC423', ls='--')
ax1.plot(netEnergyAnnual_TWh.index, netEnergyAnnual_TWh.iloc[:,[5]], color='#8CC63F', ls='-.')
ax1.legend(scennames)

ax1.set_ylabel('Net Energy [TWh]')
plt.title('Annual Net Energy')
plt.show()
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

Simulation for EROI and EBPT¶

Currently we dont have the ability to do cohort energy tracking. Therefore, we will test discrete points in time to evaluate a single cohort (i.e. install in only 1 year and track the energy in and out over time from that one cohort)

In [26]:
single_deploy_2020 = pd.DataFrame(index=idx_temp, columns=['MW'], dtype=float)
single_deploy_2020['MW'] = 0.0
single_deploy_2020.loc[2020,'MW'] = 100.0
In [25]:
#creating scenarios for identical power and identical area deployed
scennames2 = ['PERC','SHJ','TOPCon'] #add later Blend and bifi on/off
MATERIALS = ['glass','silver','silicon', 'copper', 'aluminium_frames'] #'encapsulant', 'backsheet',
moduleFile_m = os.path.join(baselinesfolder, 'baseline_modules_mass_US.csv')
moduleFile_e = os.path.join(baselinesfolder, 'baseline_modules_energy.csv')
In [27]:
#load in a baseline and materials for modification
import PV_ICE

sim2 = PV_ICE.Simulation(name='sim1', path=testfolder)
for scen in scennames2:
    sim2.createScenario(name=scen, massmodulefile=moduleFile_m, energymodulefile=moduleFile_e)
    for mat in range (0, len(MATERIALS)):
        matbaseline_m = os.path.join(baselinesfolder,'baseline_material_mass_'+MATERIALS[mat]+'.csv')
        matbaseline_e = os.path.join(baselinesfolder,'baseline_material_energy_'+MATERIALS[mat]+'.csv')
        sim2.scenario[scen].addMaterial(MATERIALS[mat], massmatfile=matbaseline_m, energymatfile=matbaseline_e)
path = C:\Users\hmirletz\Documents\GitHub\PV_ICE\PV_ICE\TEMP\CellTechCompare

Modify the all one tech scenarios Scenarios:

Module level

  • trim to 2020-2050
  • no circularity
  • deployment projection
  • module eff

material level

  • glass per m2
  • silver per m2
In [32]:
#no circularity
sim2.scenMod_noCircularity()

#module eff
for scen in scennames2:
    sim2.scenario[scen].dataIn_m.loc[25:25+len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values

#glass modify
for scen in scennames2:
    sim2.scenario[scen].material['glass'].matdataIn_m['mat_massperm2'] = glassperm2
    
#silver modify
for scen in scennames2:
    sim2.scenario[scen].material['silver'].matdataIn_m.loc[25:25+len(Aguse.index-1),'mat_massperm2'] = Aguse.filter(like=str(scen[0:3])).values
    
#deployment projection
#NEED TO PULL IN DEPLOYMENT PROJECTION
for scen in scennames2:
    sim2.scenario[scen].dataIn_m.loc[25:25+len(single_deploy_2020.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2020.values   

#trim to 2020-2050, this trims module and materials
sim2.trim_Years(startYear=2020, endYear=2050)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [32], in <cell line: 18>()
     16 #deployment projection
     17 #NEED TO PULL IN DEPLOYMENT PROJECTION
     18 for scen in scennames2:
---> 19     sim2.scenario[scen].dataIn_m.loc[25:25+len(single_deploy_2020.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2020.values   
     21 #trim to 2020-2050, this trims module and materials
     22 sim2.trim_Years(startYear=2020, endYear=2050)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:716, in _LocationIndexer.__setitem__(self, key, value)
    713 self._has_valid_setitem_indexer(key)
    715 iloc = self if self.name == "iloc" else self.obj.iloc
--> 716 iloc._setitem_with_indexer(indexer, value, self.name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1691, in _iLocIndexer._setitem_with_indexer(self, indexer, value, name)
   1688 # align and set the values
   1689 if take_split_path:
   1690     # We have to operate column-wise
-> 1691     self._setitem_with_indexer_split_path(indexer, value, name)
   1692 else:
   1693     self._setitem_single_block(indexer, value, name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1730, in _iLocIndexer._setitem_with_indexer_split_path(self, indexer, value, name)
   1727     self._setitem_with_indexer_frame_value(indexer, value, name)
   1729 elif np.ndim(value) == 2:
-> 1730     self._setitem_with_indexer_2d_value(indexer, value)
   1732 elif len(ilocs) == 1 and lplane_indexer == len(value) and not is_scalar(pi):
   1733     # We are setting multiple rows in a single column.
   1734     self._setitem_single_column(ilocs[0], value, pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1802, in _iLocIndexer._setitem_with_indexer_2d_value(self, indexer, value)
   1796     raise ValueError(
   1797         "Must have equal len keys and value when setting with an ndarray"
   1798     )
   1800 for i, loc in enumerate(ilocs):
   1801     # setting with a list, re-coerces
-> 1802     self._setitem_single_column(loc, value[:, i].tolist(), pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1890, in _iLocIndexer._setitem_single_column(self, loc, value, plane_indexer)
   1884 else:
   1885     # set the item, first attempting to operate inplace, then
   1886     #  falling back to casting if necessary; see
   1887     #  _whatsnew_130.notable_bug_fixes.setitem_column_try_inplace
   1889     orig_values = ser._values
-> 1890     ser._mgr = ser._mgr.setitem((pi,), value)
   1892     if ser._values is orig_values:
   1893         # The setitem happened inplace, so the DataFrame's values
   1894         #  were modified inplace.
   1895         return

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:337, in BaseBlockManager.setitem(self, indexer, value)
    331 def setitem(self: T, indexer, value) -> T:
    332     """
    333     Set values with indexer.
    334 
    335     For SingleBlockManager, this backs s[indexer] = value
    336     """
--> 337     return self.apply("setitem", indexer=indexer, value=value)

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:304, in BaseBlockManager.apply(self, f, align_keys, ignore_failures, **kwargs)
    302         applied = b.apply(f, **kwargs)
    303     else:
--> 304         applied = getattr(b, f)(**kwargs)
    305 except (TypeError, NotImplementedError):
    306     if not ignore_failures:

File ~\Anaconda3\lib\site-packages\pandas\core\internals\blocks.py:959, in Block.setitem(self, indexer, value)
    957 else:
    958     value = setitem_datetimelike_compat(values, len(values[indexer]), value)
--> 959     values[indexer] = value
    961 return self

ValueError: could not broadcast input array from shape (52,) into shape (31,)
In [ ]:
sim2.scenario['PERC'].dataIn_e
In [ ]:
for scen in scennames2:
    sim2.scenario[scen].dataIn_m.to_csv(os.path.join(testfolder,str('sim2_baseline_'+scen+'.csv')))

2020 Module¶

In [ ]:
#option 1, install identical power

sim2.calculateFlows(scenarios='PERC', bifacialityfactors=bifi_perc_path)
sim2.calculateFlows(scenarios='SHJ', bifacialityfactors=bifi_shj_path)
sim2.calculateFlows(scenarios='TOPCon', bifacialityfactors=bifi_topcon_path)

#perc_p_yearly, perc_p_cum = sim2.aggregateResults(scenarios='PERC')
#shj_p_yearly, shj_p_cum = sim2.aggregateResults(scenarios='SHJ')
#topcon_p_yearly, topcon_p_cum = sim2.aggregateResults(scenarios='TOPCon')
In [ ]:
plt.plot(sim2.scenario['PERC'].dataOut_m['Installed_Capacity_[W]'])
In [ ]:
#compile all energy out results
energy_mod2=pd.DataFrame()
for scen in scennames2:
    # add the scen name as a prefix for later filtering
    scende = sim2.scenario[scen].dataOut_e.loc[0:30].add_prefix(str(scen+'_'))
    #concat into one large df
    energy_mod2 = pd.concat([energy_mod2, scende], axis=1)

#energy_mod2.head()
In [ ]:
energy_mat2 = pd.DataFrame()
for scen in scennames2:
    for mat in MATERIALS:
        # add the scen name as a prefix for later filtering
        scenmatde = sim2.scenario[scen].material[mat].matdataOut_e.loc[0:30].add_prefix(str(scen+'_'+mat+'_'))
        #concat into one large df
        energy_mat2 = pd.concat([energy_mat2, scenmatde], axis=1)

#energy_mat2.tail()
In [ ]:
allenergy2 = pd.concat([energy_mod2,energy_mat2], axis=1)
allenergy2.index=idx_temp
In [ ]:
allenergy2
In [ ]:
perc_e_flows = allenergy2.filter(like='PERC')
perc_e_out = perc_e_flows.filter(like='e_out_annual_[Wh]')
perc_e_demand = perc_e_flows.loc[:,~perc_e_flows.columns.isin(perc_e_out.columns)] 

shj_e_flows = allenergy2.filter(like='SHJ')
shj_e_out = shj_e_flows.filter(like='e_out_annual_[Wh]')
shj_e_demand = shj_e_flows.loc[:,~shj_e_flows.columns.isin(shj_e_out.columns)] 

topcon_e_flows = allenergy2.filter(like='TOPCon')
topcon_e_out = topcon_e_flows.filter(like='e_out_annual_[Wh]')
topcon_e_demand = topcon_e_flows.loc[:,~topcon_e_flows.columns.isin(topcon_e_out.columns)] 
In [29]:
perc_e_demand_total_annual = pd.DataFrame(perc_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
shj_e_demand_total_annual = pd.DataFrame(shj_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
topcon_e_demand_total_annual = pd.DataFrame(topcon_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [29], in <cell line: 1>()
----> 1 perc_e_demand_total_annual = pd.DataFrame(perc_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
      2 shj_e_demand_total_annual = pd.DataFrame(shj_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
      3 topcon_e_demand_total_annual = pd.DataFrame(topcon_e_demand.sum(axis=1), columns=['Wh'])

NameError: name 'perc_e_demand' is not defined
In [30]:
perc_e_out.columns=perc_e_demand_total_annual.columns
perc_net_energy_annual = perc_e_out-perc_e_demand_total_annual
#perc_net_energy_annual/1e9 # GWh

shj_e_out.columns = shj_e_demand_total_annual.columns
shj_net_energy_annual = shj_e_out - shj_e_demand_total_annual
#shj_net_energy_annual/1e9 # GWh

topcon_e_out.columns=topcon_e_demand_total_annual.columns
topcon_net_energy_annual = topcon_e_out - topcon_e_demand_total_annual
#perc_net_energy_annual/1e9 # GWh
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [30], in <cell line: 1>()
----> 1 perc_e_out.columns=perc_e_demand_total_annual.columns
      2 perc_net_energy_annual = perc_e_out-perc_e_demand_total_annual
      3 #perc_net_energy_annual/1e9 # GWh

NameError: name 'perc_e_demand_total_annual' is not defined
In [31]:
width = 0.3
plt.bar(perc_net_energy_annual.index-width, perc_net_energy_annual['Wh']/1e9, width, color='#0079C2')
plt.bar(shj_net_energy_annual.index+width, shj_net_energy_annual['Wh']/1e9, width, color='#F7A11A' )
plt.bar(topcon_net_energy_annual.index, topcon_net_energy_annual['Wh']/1e9, width, color='#5D9732')

plt.legend(scennames2, loc='lower center')
plt.title('Net Annual Energy: 2020 Module')
plt.ylabel('Net Energy [GWh]')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [31], in <cell line: 2>()
      1 width = 0.3
----> 2 plt.bar(perc_net_energy_annual.index-width, perc_net_energy_annual['Wh']/1e9, width, color='#0079C2')
      3 plt.bar(shj_net_energy_annual.index+width, shj_net_energy_annual['Wh']/1e9, width, color='#F7A11A' )
      4 plt.bar(topcon_net_energy_annual.index, topcon_net_energy_annual['Wh']/1e9, width, color='#5D9732')

NameError: name 'perc_net_energy_annual' is not defined
In [123]:
#EROI = Eout/Ein
perc_e_out_cum = perc_e_out.sum()
perc_e_in_cum = perc_e_demand_total_annual.sum()
EROI_perc_2020 = perc_e_out_cum[0]/perc_e_in_cum[0]
EROI_perc_2020
Out[123]:
70.48059248401727
In [124]:
shj_e_out_cum = shj_e_out.sum()
shj_e_in_cum = shj_e_demand_total_annual.sum()
EROI_shj_2020 = shj_e_out_cum[0]/shj_e_in_cum[0]
EROI_shj_2020
Out[124]:
74.67238683840192
In [125]:
topcon_e_out_cum = topcon_e_out.sum()
topcon_e_in_cum = topcon_e_demand_total_annual.sum()
EROI_topcon_2020 = topcon_e_out_cum[0]/topcon_e_in_cum[0]
EROI_topcon_2020
Out[125]:
72.6826553169137
In [126]:
eroi_2020_module = pd.DataFrame({'2020 Design':[EROI_perc_2020,EROI_shj_2020,EROI_topcon_2020]}, index=['PERC','SHJ','TOPCon'])
eroi_2020_module
Out[126]:
2020 Design
PERC 70.480592
SHJ 74.672387
TOPCon 72.682655

2030 Module¶

Grab the module properties from 2030, and deploy 100 MW for 30 yr project life

In [127]:
idx_30_60 = pd.Series(range(2030,2061))
single_deploy_2030 = pd.DataFrame(index=idx_30_60, columns=['MW'], dtype=float)
single_deploy_2030['MW'] = 0.0
single_deploy_2030.loc[2030,'MW'] = 100.0
#single_deploy_2030
In [128]:
#creating scenarios for identical power and identical area deployed
scennames3 = ['PERC','SHJ','TOPCon'] #add later Blend and bifi on/off
MATERIALS = ['glass','silver','silicon'] #, 'copper', 'encapsulant', 'backsheet', 'aluminum_frames'
moduleFile_m = os.path.join(baselinesfolder, 'baseline_modules_mass_US.csv')
moduleFile_e = os.path.join(baselinesfolder, 'baseline_modules_energy.csv')
In [129]:
#load in a baseline and materials for modification
import PV_ICE

sim3 = PV_ICE.Simulation(name='sim1', path=testfolder)
for scen in scennames3:
    sim3.createScenario(name=scen, massmodulefile=moduleFile_m, energymodulefile=moduleFile_e)
    for mat in range (0, len(MATERIALS)):
        matbaseline_m = os.path.join(baselinesfolder,'baseline_material_mass_'+MATERIALS[mat]+'.csv')
        matbaseline_e = os.path.join(baselinesfolder,'baseline_material_energy_'+MATERIALS[mat]+'.csv')
        sim3.scenario[scen].addMaterial(MATERIALS[mat], massmatfile=matbaseline_m, energymatfile=matbaseline_e)
path = C:\Users\hmirletz\Documents\GitHub\PV_ICE\PV_ICE\TEMP\CellTechCompare

Modify the all one tech scenarios Scenarios:

Module level

  • trim to 2020-2050
  • no circularity
  • deployment projection
  • module eff

material level

  • glass per m2
  • silver per m2
In [137]:
#no circularity
sim3.scenMod_noCircularity()

#module eff
for scen in scennames3:
    sim3.scenario[scen].dataIn_m.loc[25:25+len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values

#glass modify
for scen in scennames3:
    sim3.scenario[scen].material['glass'].matdataIn_m['mat_massperm2'] = glassperm2
    
#silver modify
for scen in scennames3:
    sim3.scenario[scen].material['silver'].matdataIn_m.loc[25:25+len(Aguse.index-1),'mat_massperm2'] = Aguse.filter(like=str(scen[0:3])).values
    
sim3.modifyScenario('new_Installed_Capacity_[MW]', 0.0)

#trim to 2020-2050, this trims module and materials
sim3.trim_Years(startYear=2030, endYear=2100)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [137], in <cell line: 5>()
      4 #module eff
      5 for scen in scennames3:
----> 6     sim3.scenario[scen].dataIn_m.loc[25:25+len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values
      8 #glass modify
      9 for scen in scennames3:

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:716, in _LocationIndexer.__setitem__(self, key, value)
    713 self._has_valid_setitem_indexer(key)
    715 iloc = self if self.name == "iloc" else self.obj.iloc
--> 716 iloc._setitem_with_indexer(indexer, value, self.name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1691, in _iLocIndexer._setitem_with_indexer(self, indexer, value, name)
   1688 # align and set the values
   1689 if take_split_path:
   1690     # We have to operate column-wise
-> 1691     self._setitem_with_indexer_split_path(indexer, value, name)
   1692 else:
   1693     self._setitem_single_block(indexer, value, name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1730, in _iLocIndexer._setitem_with_indexer_split_path(self, indexer, value, name)
   1727     self._setitem_with_indexer_frame_value(indexer, value, name)
   1729 elif np.ndim(value) == 2:
-> 1730     self._setitem_with_indexer_2d_value(indexer, value)
   1732 elif len(ilocs) == 1 and lplane_indexer == len(value) and not is_scalar(pi):
   1733     # We are setting multiple rows in a single column.
   1734     self._setitem_single_column(ilocs[0], value, pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1802, in _iLocIndexer._setitem_with_indexer_2d_value(self, indexer, value)
   1796     raise ValueError(
   1797         "Must have equal len keys and value when setting with an ndarray"
   1798     )
   1800 for i, loc in enumerate(ilocs):
   1801     # setting with a list, re-coerces
-> 1802     self._setitem_single_column(loc, value[:, i].tolist(), pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1890, in _iLocIndexer._setitem_single_column(self, loc, value, plane_indexer)
   1884 else:
   1885     # set the item, first attempting to operate inplace, then
   1886     #  falling back to casting if necessary; see
   1887     #  _whatsnew_130.notable_bug_fixes.setitem_column_try_inplace
   1889     orig_values = ser._values
-> 1890     ser._mgr = ser._mgr.setitem((pi,), value)
   1892     if ser._values is orig_values:
   1893         # The setitem happened inplace, so the DataFrame's values
   1894         #  were modified inplace.
   1895         return

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:337, in BaseBlockManager.setitem(self, indexer, value)
    331 def setitem(self: T, indexer, value) -> T:
    332     """
    333     Set values with indexer.
    334 
    335     For SingleBlockManager, this backs s[indexer] = value
    336     """
--> 337     return self.apply("setitem", indexer=indexer, value=value)

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:304, in BaseBlockManager.apply(self, f, align_keys, ignore_failures, **kwargs)
    302         applied = b.apply(f, **kwargs)
    303     else:
--> 304         applied = getattr(b, f)(**kwargs)
    305 except (TypeError, NotImplementedError):
    306     if not ignore_failures:

File ~\Anaconda3\lib\site-packages\pandas\core\internals\blocks.py:959, in Block.setitem(self, indexer, value)
    957 else:
    958     value = setitem_datetimelike_compat(values, len(values[indexer]), value)
--> 959     values[indexer] = value
    961 return self

ValueError: could not broadcast input array from shape (31,) into shape (32,)
In [138]:
#Set 2020 module and material properties = 2030
for scen in scennames3:
    sim3.scenario[scen].dataIn_m.loc[0] = sim3.scenario[scen].dataIn_m.loc[10] #reassign row values from 2030 to 2020
    sim3.scenario[scen].dataIn_m.loc[0,'year'] = 2020 #fix the overwrite
    
sim3.scenario[scen].dataIn_m.tail()
Out[138]:
year new_Installed_Capacity_[MW] mod_eff mod_reliability_t50 mod_reliability_t90 mod_degradation mod_lifetime mod_MFG_eff mod_Repair mod_MerchantTail ... mod_EOL_pg1_landfill mod_EOL_pg2_stored mod_EOL_pg3_reMFG mod_EOL_pg4_recycled mod_EOL_reMFG_yield mod_EOL_sp_reMFG_recycle mod_EOL_pb1_landfill mod_EOL_pb2_stored mod_EOL_pb3_reMFG mod_EOL_pb4_recycled
66 2096 152662.6502 25.0 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
67 2097 152662.6502 25.0 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
68 2098 152662.6502 25.0 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
69 2099 152662.6502 25.0 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0
70 2100 152662.6502 25.0 40.0 44.0 0.5 35.0 98.0 0.0 0.0 ... 100.0 0.0 0.0 0.0 0.0 0.0 100.0 0.0 0.0 0.0

5 rows × 22 columns

In [132]:
#deployment projection
#NEED TO PULL IN DEPLOYMENT PROJECTION

for scen in scennames3:
    sim3.scenario[scen].dataIn_m.loc[0:len(single_deploy_2020.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2020.values
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [132], in <cell line: 4>()
      1 #deployment projection
      2 #NEED TO PULL IN DEPLOYMENT PROJECTION
      4 for scen in scennames3:
----> 5     sim3.scenario[scen].dataIn_m.loc[0:len(single_deploy_2020.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2020.values

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:716, in _LocationIndexer.__setitem__(self, key, value)
    713 self._has_valid_setitem_indexer(key)
    715 iloc = self if self.name == "iloc" else self.obj.iloc
--> 716 iloc._setitem_with_indexer(indexer, value, self.name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1691, in _iLocIndexer._setitem_with_indexer(self, indexer, value, name)
   1688 # align and set the values
   1689 if take_split_path:
   1690     # We have to operate column-wise
-> 1691     self._setitem_with_indexer_split_path(indexer, value, name)
   1692 else:
   1693     self._setitem_single_block(indexer, value, name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1730, in _iLocIndexer._setitem_with_indexer_split_path(self, indexer, value, name)
   1727     self._setitem_with_indexer_frame_value(indexer, value, name)
   1729 elif np.ndim(value) == 2:
-> 1730     self._setitem_with_indexer_2d_value(indexer, value)
   1732 elif len(ilocs) == 1 and lplane_indexer == len(value) and not is_scalar(pi):
   1733     # We are setting multiple rows in a single column.
   1734     self._setitem_single_column(ilocs[0], value, pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1802, in _iLocIndexer._setitem_with_indexer_2d_value(self, indexer, value)
   1796     raise ValueError(
   1797         "Must have equal len keys and value when setting with an ndarray"
   1798     )
   1800 for i, loc in enumerate(ilocs):
   1801     # setting with a list, re-coerces
-> 1802     self._setitem_single_column(loc, value[:, i].tolist(), pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1890, in _iLocIndexer._setitem_single_column(self, loc, value, plane_indexer)
   1884 else:
   1885     # set the item, first attempting to operate inplace, then
   1886     #  falling back to casting if necessary; see
   1887     #  _whatsnew_130.notable_bug_fixes.setitem_column_try_inplace
   1889     orig_values = ser._values
-> 1890     ser._mgr = ser._mgr.setitem((pi,), value)
   1892     if ser._values is orig_values:
   1893         # The setitem happened inplace, so the DataFrame's values
   1894         #  were modified inplace.
   1895         return

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:337, in BaseBlockManager.setitem(self, indexer, value)
    331 def setitem(self: T, indexer, value) -> T:
    332     """
    333     Set values with indexer.
    334 
    335     For SingleBlockManager, this backs s[indexer] = value
    336     """
--> 337     return self.apply("setitem", indexer=indexer, value=value)

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:304, in BaseBlockManager.apply(self, f, align_keys, ignore_failures, **kwargs)
    302         applied = b.apply(f, **kwargs)
    303     else:
--> 304         applied = getattr(b, f)(**kwargs)
    305 except (TypeError, NotImplementedError):
    306     if not ignore_failures:

File ~\Anaconda3\lib\site-packages\pandas\core\internals\blocks.py:959, in Block.setitem(self, indexer, value)
    957 else:
    958     value = setitem_datetimelike_compat(values, len(values[indexer]), value)
--> 959     values[indexer] = value
    961 return self

ValueError: could not broadcast input array from shape (31,) into shape (32,)
In [ ]:
sim3.scenario[scen].dataIn_m.head()
In [ ]:
#deployment projection
#NEED TO PULL IN DEPLOYMENT PROJECTION

#for scen in scennames2:
#    sim2.scenario[scen].dataIn_m.loc[0:len(single_deploy_2030.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2030.values
In [133]:
#option 1, install identical power

sim3.calculateFlows(scenarios='PERC', bifacialityfactors=bifi_perc_path)
sim3.calculateFlows(scenarios='SHJ', bifacialityfactors=bifi_shj_path)
sim3.calculateFlows(scenarios='TOPCon', bifacialityfactors=bifi_topcon_path)

#perc_p_yearly, perc_p_cum = sim2.aggregateResults(scenarios='PERC')
#shj_p_yearly, shj_p_cum = sim2.aggregateResults(scenarios='SHJ')
#topcon_p_yearly, topcon_p_cum = sim2.aggregateResults(scenarios='TOPCon')
>>>> Calculating Material Flows <<<<

Working on Scenario:  PERC
********************
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  PERC
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
>>>> Calculating Material Flows <<<<

Working on Scenario:  SHJ
********************
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  SHJ
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
>>>> Calculating Material Flows <<<<

Working on Scenario:  TOPCon
********************
Finished Area+Power Generation Calculations
==> Working on Material :  glass
==> Working on Material :  silver
==> Working on Material :  silicon


>>>> Calculating Energy Flows <<<<

Working on Scenario:  TOPCon
********************
==> Working on Energy for Material :  glass
==> Working on Energy for Material :  silver
==> Working on Energy for Material :  silicon
In [ ]:
 
In [ ]:
plt.plot(sim3.scenario['PERC'].dataOut_m['Installed_Capacity_[W]'])
In [ ]:
#compile all energy out results
energy_mod3=pd.DataFrame()
for scen in scennames3:
    # add the scen name as a prefix for later filtering
    scende = sim3.scenario[scen].dataOut_e.loc[0:30].add_prefix(str(scen+'_'))
    #concat into one large df
    energy_mod3 = pd.concat([energy_mod3, scende], axis=1)

#energy_mod2.head()
In [ ]:
#compile material energy demands
energy_mat3 = pd.DataFrame()
for scen in scennames3:
    for mat in MATERIALS:
        # add the scen name as a prefix for later filtering
        scenmatde = sim3.scenario[scen].material[mat].matdataOut_e.loc[0:30].add_prefix(str(scen+'_'+mat+'_'))
        #concat into one large df
        energy_mat3 = pd.concat([energy_mat3, scenmatde], axis=1)

#energy_mat3.tail()
In [ ]:
allenergy3 = pd.concat([energy_mod3,energy_mat3], axis=1)
allenergy3.index=idx_30_60
In [ ]:
allenergy3
In [ ]:
perc_e_flows = allenergy3.filter(like='PERC')
perc_e_out = perc_e_flows.filter(like='e_out_annual_[Wh]')
perc_e_demand = perc_e_flows.loc[:,~perc_e_flows.columns.isin(perc_e_out.columns)] 

shj_e_flows = allenergy3.filter(like='SHJ')
shj_e_out = shj_e_flows.filter(like='e_out_annual_[Wh]')
shj_e_demand = shj_e_flows.loc[:,~shj_e_flows.columns.isin(shj_e_out.columns)] 

topcon_e_flows = allenergy3.filter(like='TOPCon')
topcon_e_out = topcon_e_flows.filter(like='e_out_annual_[Wh]')
topcon_e_demand = topcon_e_flows.loc[:,~topcon_e_flows.columns.isin(topcon_e_out.columns)] 
In [ ]:
perc_e_demand_total_annual = pd.DataFrame(perc_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
shj_e_demand_total_annual = pd.DataFrame(shj_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
topcon_e_demand_total_annual = pd.DataFrame(topcon_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
In [ ]:
perc_e_out.columns=perc_e_demand_total_annual.columns
perc_net_energy_annual = perc_e_out-perc_e_demand_total_annual
#perc_net_energy_annual/1e9 # GWh

shj_e_out.columns = shj_e_demand_total_annual.columns
shj_net_energy_annual = shj_e_out - shj_e_demand_total_annual
#shj_net_energy_annual/1e9 # GWh

topcon_e_out.columns=topcon_e_demand_total_annual.columns
topcon_net_energy_annual = topcon_e_out - topcon_e_demand_total_annual
#perc_net_energy_annual/1e9 # GWh
In [ ]:
width = 0.3
plt.bar(perc_net_energy_annual.index-width, perc_net_energy_annual['Wh']/1e9, width, color='#0079C2')
plt.bar(shj_net_energy_annual.index+width, shj_net_energy_annual['Wh']/1e9, width, color='#F7A11A' )
plt.bar(topcon_net_energy_annual.index, topcon_net_energy_annual['Wh']/1e9, width, color='#5D9732')

plt.legend(scennames2, loc='lower center')
plt.title('Net Annual Energy: 2030 Module')
plt.ylabel('Net Energy [GWh]')
In [ ]:
#EROI = Eout/Ein
perc_e_out_cum = perc_e_out.sum()
perc_e_in_cum = perc_e_demand_total_annual.sum()
EROI_perc_2030 = perc_e_out_cum[0]/perc_e_in_cum[0]
EROI_perc_2030
In [ ]:
shj_e_out_cum = shj_e_out.sum()
shj_e_in_cum = shj_e_demand_total_annual.sum()
EROI_shj_2030 = shj_e_out_cum[0]/shj_e_in_cum[0]
EROI_shj_2030
In [ ]:
topcon_e_out_cum = topcon_e_out.sum()
topcon_e_in_cum = topcon_e_demand_total_annual.sum()
EROI_topcon_2030 = topcon_e_out_cum[0]/topcon_e_in_cum[0]
EROI_topcon_2030
In [ ]:
eroi_2030_module = pd.DataFrame({'2030 Design':[EROI_perc_2030,EROI_shj_2030,EROI_topcon_2030]}, index=['PERC','SHJ','TOPCon'])
eroi_2030_module

2050 Module¶

In [ ]:
 
In [ ]:
idx_50_80 = pd.Series(range(2050,2081))
In [ ]:
#creating scenarios for identical power and identical area deployed
scennames4 = ['PERC','SHJ','TOPCon'] #add later Blend and bifi on/off
MATERIALS = ['glass','silver','silicon'] #, 'copper', 'encapsulant', 'backsheet', 'aluminum_frames'
moduleFile_m = os.path.join(baselinesfolder, 'baseline_modules_mass_US.csv')
moduleFile_e = os.path.join(baselinesfolder, 'baseline_modules_energy.csv')
In [ ]:
#load in a baseline and materials for modification
import PV_ICE

sim4 = PV_ICE.Simulation(name='sim1', path=testfolder)
for scen in scennames4:
    sim4.createScenario(name=scen, massmodulefile=moduleFile_m, energymodulefile=moduleFile_e)
    for mat in range (0, len(MATERIALS)):
        matbaseline_m = os.path.join(baselinesfolder,'baseline_material_mass_'+MATERIALS[mat]+'.csv')
        matbaseline_e = os.path.join(baselinesfolder,'baseline_material_energy_'+MATERIALS[mat]+'.csv')
        sim4.scenario[scen].addMaterial(MATERIALS[mat], massmatfile=matbaseline_m, energymatfile=matbaseline_e)

Modify the all one tech scenarios Scenarios:

Module level

  • trim to 2020-2050
  • no circularity
  • deployment projection
  • module eff

material level

  • glass per m2
  • silver per m2
In [ ]:
#no circularity
sim4.scenMod_noCircularity()

#module eff
for scen in scennames4:
    sim4.scenario[scen].dataIn_m.loc[25:25+len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values

#glass modify
for scen in scennames4:
    sim4.scenario[scen].material['glass'].matdataIn_m['mat_massperm2'] = glassperm2
    
#silver modify
for scen in scennames4:
    sim4.scenario[scen].material['silver'].matdataIn_m.loc[25:25+len(Aguse.index-1),'mat_massperm2'] = Aguse.filter(like=str(scen[0:3])).values
    
#trim to 2020-2050, this trims module and materials
sim4.trim_Years(startYear=2020, endYear=2100)
In [ ]:
#Set 2020 module and material properties = 2030
for scen in scennames4:
    sim4.scenario[scen].dataIn_m.loc[0] = sim4.scenario[scen].dataIn_m.iloc[-1] #reassign row values from 2030 to 2020
    sim4.scenario[scen].dataIn_m.loc[0,'year'] = 2020 #fix the overwrite
    
sim4.scenario[scen].dataIn_m.head()
In [ ]:
#deployment projection
#NEED TO PULL IN DEPLOYMENT PROJECTION

for scen in scennames4:
    sim4.scenario[scen].dataIn_m.loc[0:len(single_deploy_2020.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2020.values
In [ ]:
sim4.scenario[scen].dataIn_m.head()
In [ ]:
#deployment projection
#NEED TO PULL IN DEPLOYMENT PROJECTION

#for scen in scennames2:
#    sim2.scenario[scen].dataIn_m.loc[0:len(single_deploy_2030.index-1),'new_Installed_Capacity_[MW]'] = single_deploy_2030.values
In [ ]:
#option 1, install identical power

sim4.calculateFlows(scenarios='PERC', bifacialityfactors=bifi_perc_path)
sim4.calculateFlows(scenarios='SHJ', bifacialityfactors=bifi_shj_path)
sim4.calculateFlows(scenarios='TOPCon', bifacialityfactors=bifi_topcon_path)

#perc_p_yearly, perc_p_cum = sim2.aggregateResults(scenarios='PERC')
#shj_p_yearly, shj_p_cum = sim2.aggregateResults(scenarios='SHJ')
#topcon_p_yearly, topcon_p_cum = sim2.aggregateResults(scenarios='TOPCon')
In [ ]:
 
In [ ]:
plt.plot(sim4.scenario['PERC'].dataOut_m['Installed_Capacity_[W]'])
In [ ]:
#compile all energy out results
energy_mod4=pd.DataFrame()
for scen in scennames4:
    # add the scen name as a prefix for later filtering
    scende = sim4.scenario[scen].dataOut_e.loc[0:30].add_prefix(str(scen+'_'))
    #concat into one large df
    energy_mod4 = pd.concat([energy_mod4, scende], axis=1)

#energy_mod2.head()
In [ ]:
#compile material energy demands
energy_mat4 = pd.DataFrame()
for scen in scennames4:
    for mat in MATERIALS:
        # add the scen name as a prefix for later filtering
        scenmatde = sim4.scenario[scen].material[mat].matdataOut_e.loc[0:30].add_prefix(str(scen+'_'+mat+'_'))
        #concat into one large df
        energy_mat4 = pd.concat([energy_mat4, scenmatde], axis=1)

#energy_mat3.tail()
In [ ]:
allenergy4 = pd.concat([energy_mod4,energy_mat4], axis=1)
allenergy4.index=idx_50_80
In [ ]:
allenergy4
In [ ]:
perc_e_flows = allenergy4.filter(like='PERC')
perc_e_out = perc_e_flows.filter(like='e_out_annual_[Wh]')
perc_e_demand = perc_e_flows.loc[:,~perc_e_flows.columns.isin(perc_e_out.columns)] 

shj_e_flows = allenergy4.filter(like='SHJ')
shj_e_out = shj_e_flows.filter(like='e_out_annual_[Wh]')
shj_e_demand = shj_e_flows.loc[:,~shj_e_flows.columns.isin(shj_e_out.columns)] 

topcon_e_flows = allenergy4.filter(like='TOPCon')
topcon_e_out = topcon_e_flows.filter(like='e_out_annual_[Wh]')
topcon_e_demand = topcon_e_flows.loc[:,~topcon_e_flows.columns.isin(topcon_e_out.columns)] 
In [ ]:
perc_e_demand_total_annual = pd.DataFrame(perc_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
shj_e_demand_total_annual = pd.DataFrame(shj_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
topcon_e_demand_total_annual = pd.DataFrame(topcon_e_demand.sum(axis=1), columns=['Wh']) #includes module and material
In [ ]:
perc_e_out.columns=perc_e_demand_total_annual.columns
perc_net_energy_annual = perc_e_out-perc_e_demand_total_annual
#perc_net_energy_annual/1e9 # GWh

shj_e_out.columns = shj_e_demand_total_annual.columns
shj_net_energy_annual = shj_e_out - shj_e_demand_total_annual
#shj_net_energy_annual/1e9 # GWh

topcon_e_out.columns=topcon_e_demand_total_annual.columns
topcon_net_energy_annual = topcon_e_out - topcon_e_demand_total_annual
#perc_net_energy_annual/1e9 # GWh
In [ ]:
width = 0.3
plt.bar(perc_net_energy_annual.index-width, perc_net_energy_annual['Wh']/1e9, width, color='#0079C2')
plt.bar(shj_net_energy_annual.index+width, shj_net_energy_annual['Wh']/1e9, width, color='#F7A11A' )
plt.bar(topcon_net_energy_annual.index, topcon_net_energy_annual['Wh']/1e9, width, color='#5D9732')

plt.legend(scennames2, loc='lower center')
plt.title('Net Annual Energy: 2050 Module')
plt.ylabel('Net Energy [GWh]')
In [ ]:
#EROI = Eout/Ein
perc_e_out_cum = perc_e_out.sum()
perc_e_in_cum = perc_e_demand_total_annual.sum()
EROI_perc_2050 = perc_e_out_cum[0]/perc_e_in_cum[0]
EROI_perc_2050
In [ ]:
shj_e_out_cum = shj_e_out.sum()
shj_e_in_cum = shj_e_demand_total_annual.sum()
EROI_shj_2050 = shj_e_out_cum[0]/shj_e_in_cum[0]
EROI_shj_2050
In [ ]:
topcon_e_out_cum = topcon_e_out.sum()
topcon_e_in_cum = topcon_e_demand_total_annual.sum()
EROI_topcon_2050 = topcon_e_out_cum[0]/topcon_e_in_cum[0]
EROI_topcon_2050
In [ ]:
eroi_2050_module = pd.DataFrame({'2050 Design':[EROI_perc_2050,EROI_shj_2050,EROI_topcon_2050]}, index=['PERC','SHJ','TOPCon'])
eroi_2050_module

Normalize the EROI to PERC 2020

In [ ]:
eroi_overtime = pd.concat([eroi_2020_module,eroi_2030_module,eroi_2050_module], axis =1)
eroi_overtime
In [ ]:
eroi_overtime_normalized = eroi_overtime/eroi_overtime.loc['PERC','2020 Design']
eroi_overtime_normalized

Net Energy over Linear Mass¶

In [ ]:
perc_netE_cum = perc_e_out_cum-perc_e_in_cum #net energy cumulative
shj_netE_cum = shj_e_out_cum-shj_e_in_cum
topcon_netE_cum = topcon_e_out_cum-topcon_e_in_cum
netE_2050_dirty = pd.concat([perc_netE_cum,shj_netE_cum,topcon_netE_cum], axis=0, keys=['PERC','SHJ','TOPCon'])
netE_2050 = netE_2050_dirty.droplevel(1)
In [ ]:
netE_2050_gwh = netE_2050/1e9
netE_2050_gwh
In [ ]:
mod2050_mass_yearly, mod2050_mass_cum = sim4.aggregateResults()
In [ ]:
vstock_allmod_2050design = mod2050_mass_cum.loc[2050].filter(like='VirginStock_Module')
vstock_allmod_2050design.index = ['PERC','SHJ','TOPCon']
lwaste_allmod_2050design = mod2050_mass_cum.loc[2050].filter(like='WasteAll_Module')
lwaste_allmod_2050design.index = ['PERC','SHJ','TOPCon']
In [ ]:
linMass2050 = vstock_allmod_2050design+lwaste_allmod_2050design
linMass2050
In [ ]:
metric_2050mod = netE_2050_gwh/linMass2050
In [ ]:
metric_2050mod/metric_2050mod['PERC']

Manufacturing Energy of One module each year¶

Assuming a 2.0 m^2 module

In [33]:
scennames_anModule = ['PERC_anModule','SHJ_anModule','TOPCon_anModule']
bifipaths = [bifi_perc_path,bifi_shj_path,bifi_topcon_path]
In [34]:
#create an area dataframe to feed in a module each year
idx_temp = Aguse.index #grab matching index
area_deploy_anModule = pd.DataFrame(index=idx_temp, dtype=float) #create an empty DF
area_deploy_anModule['Area'] = 2.0
area_deploy_anModule.head()
Out[34]:
Area
2020 2.0
2021 2.0
2022 2.0
2023 2.0
2024 2.0
In [37]:
#creating scenarios for identical power and identical area deployed
MATERIALS = ['glass','silver','silicon', 'copper', 'aluminium_frames'] # 'encapsulant', 'backsheet', 
moduleFile_m = os.path.join(baselinesfolder, 'baseline_modules_mass_US.csv')
moduleFile_e = os.path.join(baselinesfolder, 'baseline_modules_energy.csv')
In [38]:
#load in a baseline and materials for modification
import PV_ICE

sim_anModule = PV_ICE.Simulation(name='sim_anModule', path=testfolder)
for scen in scennames_anModule:
    sim_anModule.createScenario(name=scen, massmodulefile=moduleFile_m, energymodulefile=moduleFile_e)
    for mat in range (0, len(MATERIALS)):
        matbaseline_m = os.path.join(baselinesfolder,'baseline_material_mass_'+MATERIALS[mat]+'.csv')
        matbaseline_e = os.path.join(baselinesfolder,'baseline_material_energy_'+MATERIALS[mat]+'.csv')
        sim_anModule.scenario[scen].addMaterial(MATERIALS[mat], massmatfile=matbaseline_m, energymatfile=matbaseline_e)
path = C:\Users\hmirletz\Documents\GitHub\PV_ICE\PV_ICE\TEMP\CellTechCompare

Modify the all one tech scenarios Scenarios:

Module level

  • trim to 2020-2050
  • no circularity
  • deployment projection
  • module eff

material level

  • glass per m2
  • silver per m2
In [41]:
len(modeffs)
Out[41]:
31
In [43]:
#no circularity
sim_anModule.scenMod_noCircularity()

#module eff
for scen in scennames_anModule:
    sim_anModule.scenario[scen].dataIn_m.loc[0:len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values

#glass modify
for scen in scennames_anModule:
    sim_anModule.scenario[scen].material['glass'].matdataIn_m['mat_massperm2'] = glassperm2
    
#silver modify
for scen in scennames_anModule:
    sim_anModule.scenario[scen].material['silver'].matdataIn_m.loc[0:len(Aguse.index-1),'mat_massperm2'] = Aguse.filter(like=str(scen[0:3])).values
    
#trim to 2020-2050, this trims module and materials
sim_anModule.trim_Years(startYear=2020, endYear=2100)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [43], in <cell line: 5>()
      4 #module eff
      5 for scen in scennames_anModule:
----> 6     sim_anModule.scenario[scen].dataIn_m.loc[0:len(modeffs.index-1),'mod_eff'] = modeffs.filter(like=str(scen[0:3])).values
      8 #glass modify
      9 for scen in scennames_anModule:

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:716, in _LocationIndexer.__setitem__(self, key, value)
    713 self._has_valid_setitem_indexer(key)
    715 iloc = self if self.name == "iloc" else self.obj.iloc
--> 716 iloc._setitem_with_indexer(indexer, value, self.name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1691, in _iLocIndexer._setitem_with_indexer(self, indexer, value, name)
   1688 # align and set the values
   1689 if take_split_path:
   1690     # We have to operate column-wise
-> 1691     self._setitem_with_indexer_split_path(indexer, value, name)
   1692 else:
   1693     self._setitem_single_block(indexer, value, name)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1730, in _iLocIndexer._setitem_with_indexer_split_path(self, indexer, value, name)
   1727     self._setitem_with_indexer_frame_value(indexer, value, name)
   1729 elif np.ndim(value) == 2:
-> 1730     self._setitem_with_indexer_2d_value(indexer, value)
   1732 elif len(ilocs) == 1 and lplane_indexer == len(value) and not is_scalar(pi):
   1733     # We are setting multiple rows in a single column.
   1734     self._setitem_single_column(ilocs[0], value, pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1802, in _iLocIndexer._setitem_with_indexer_2d_value(self, indexer, value)
   1796     raise ValueError(
   1797         "Must have equal len keys and value when setting with an ndarray"
   1798     )
   1800 for i, loc in enumerate(ilocs):
   1801     # setting with a list, re-coerces
-> 1802     self._setitem_single_column(loc, value[:, i].tolist(), pi)

File ~\Anaconda3\lib\site-packages\pandas\core\indexing.py:1890, in _iLocIndexer._setitem_single_column(self, loc, value, plane_indexer)
   1884 else:
   1885     # set the item, first attempting to operate inplace, then
   1886     #  falling back to casting if necessary; see
   1887     #  _whatsnew_130.notable_bug_fixes.setitem_column_try_inplace
   1889     orig_values = ser._values
-> 1890     ser._mgr = ser._mgr.setitem((pi,), value)
   1892     if ser._values is orig_values:
   1893         # The setitem happened inplace, so the DataFrame's values
   1894         #  were modified inplace.
   1895         return

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:337, in BaseBlockManager.setitem(self, indexer, value)
    331 def setitem(self: T, indexer, value) -> T:
    332     """
    333     Set values with indexer.
    334 
    335     For SingleBlockManager, this backs s[indexer] = value
    336     """
--> 337     return self.apply("setitem", indexer=indexer, value=value)

File ~\Anaconda3\lib\site-packages\pandas\core\internals\managers.py:304, in BaseBlockManager.apply(self, f, align_keys, ignore_failures, **kwargs)
    302         applied = b.apply(f, **kwargs)
    303     else:
--> 304         applied = getattr(b, f)(**kwargs)
    305 except (TypeError, NotImplementedError):
    306     if not ignore_failures:

File ~\Anaconda3\lib\site-packages\pandas\core\internals\blocks.py:959, in Block.setitem(self, indexer, value)
    957 else:
    958     value = setitem_datetimelike_compat(values, len(values[indexer]), value)
--> 959     values[indexer] = value
    961 return self

ValueError: could not broadcast input array from shape (31,) into shape (32,)
In [ ]:
#option 1, install identical power
sim_anModule.calculateFlows(scenarios='PERC_anModule', bifacialityfactors=bifi_perc_path, installByArea=list(area_deploy_anModule['Area']))
sim_anModule.calculateFlows(scenarios='SHJ_anModule', bifacialityfactors=bifi_shj_path,  installByArea=list(area_deploy_anModule['Area']))
sim_anModule.calculateFlows(scenarios='TOPCon_anModule', bifacialityfactors=bifi_topcon_path,  installByArea=list(area_deploy_anModule['Area']))

perc_anModule_yearly, perc_anModule_cum = sim_anModule.aggregateResults(scenarios='PERC_anModule')
shj_anModule_yearly, shj_anModule_cum = sim_anModule.aggregateResults(scenarios='SHJ_anModule')
topcon_anModule_yearly, topcon_anModule_cum = sim_anModule.aggregateResults(scenarios='TOPCon_anModule')
In [ ]:
anModule_yearly, anModule_cum = sim_anModule.aggregateResults()
anModule_yearly.columns
In [ ]:
#compile all energy out results
energy_anModule=pd.DataFrame()
for scen in scennames_anModule:
    # add the scen name as a prefix for later filtering
    scende = sim_anModule.scenario[scen].dataOut_e.loc[0:30].add_prefix(str(scen+'_'))
    #concat into one large df
    energy_anModule = pd.concat([energy_anModule, scende], axis=1)

energy_anModule.tail()
In [ ]:
energy_mat_anModule = pd.DataFrame()
for scen in scennames_anModule:
    for mat in MATERIALS:
        # add the scen name as a prefix for later filtering
        scenmatde = sim_anModule.scenario[scen].material[mat].matdataOut_e.loc[0:30].add_prefix(str(scen+'_'+mat+'_'))
        #concat into one large df
        energy_mat_anModule = pd.concat([energy_mat_anModule, scenmatde], axis=1)

energy_mat_anModule.tail()
In [ ]:
allenergy_anModule = pd.concat([energy_anModule,energy_mat_anModule], axis=1)
allenergy_anModule.index=idx_temp
In [ ]:
remove = allenergy_anModule.filter(like='e_out_annual').columns
energy_demand_anModule = allenergy_anModule.drop(columns=remove)
In [ ]:
energy_demand_anModule_perc = energy_demand_anModule.filter(like='PERC')
energy_demand_anModule_shj = energy_demand_anModule.filter(like='SHJ')
energy_demand_anModule_topcon = energy_demand_anModule.filter(like='TOPCon')
In [ ]:
energy_demand_anModule_perc_cum = pd.DataFrame(energy_demand_anModule_perc.sum(axis=1), columns=['E_mfg_anModule_[Wh]'])
energy_demand_anModule_shj_cum = pd.DataFrame(energy_demand_anModule_shj.sum(axis=1), columns=['E_mfg_anModule_[Wh]'])
energy_demand_anModule_topcon_cum = pd.DataFrame(energy_demand_anModule_topcon.sum(axis=1), columns=['E_mfg_anModule_[Wh]'])
mfg_anModule = pd.concat([energy_demand_anModule_perc_cum,energy_demand_anModule_shj_cum,energy_demand_anModule_topcon_cum], axis=1)
mfg_anModule.columns = scennames_anModule
In [ ]:
fig, ax1 = plt.subplots()
#ax1.plot(netEnergyAnnual_TWh)


ax1.plot(energy_demand_anModule_perc_cum/1e6, color='#0079C2')
ax1.plot(energy_demand_anModule_shj_cum/1e6, color='#F7A11A', ls='--')
ax1.plot(energy_demand_anModule_topcon_cum/1e6, color='#5D9732', ls='-.')

plt.legend(scennames)
#ax1.set_yscale('log')
ax1.set_ylabel('Manufacturing Energy [MWh/module]')
plt.title('Manufacturing Energy by Technology over Time')
plt.rc('font', size=18) #controls default text size
plt.show()
In [ ]:
#mfg_anModule
#shows that they are in fact slightly different energy demands between technologies.
#lets divide by PERC and see % wise how different.
mfg_anModule_normalized = mfg_anModule.iloc[:,[0,1,2]]/mfg_anModule.iloc[:,[0]].values
mfg_anModule_normalized#.loc[[2050]]

separate out by module vs material energy demand

In [ ]:
energy_mat_anModule_perc_glass = energy_mat_anModule.filter(like='PERC').filter(like='glass')
energy_mat_anModule_perc_si = energy_mat_anModule.filter(like='PERC').filter(like='silicon')
energy_mat_anModule_perc_ag = energy_mat_anModule.filter(like='PERC').filter(like='silver')

energy_anModule_perc_mod_temp = energy_anModule.filter(like='PERC')
remove_1 = energy_anModule.filter(like='PERC').filter(like='e_out').columns
energy_anModule_perc_mod = energy_anModule_perc_mod_temp.drop(columns=remove_1)
In [ ]:
emod = energy_anModule_perc_mod.sum(axis=1)
eglass = energy_mat_anModule_perc_glass.sum(axis=1)
esi = energy_mat_anModule_perc_si.sum(axis=1)
eag = energy_mat_anModule_perc_ag.sum(axis=1)
e_bkdwn_mod_mat = pd.concat([emod,eglass,esi,eag], axis=1, keys=['mod','glass','silicon','silver'])
In [ ]:
e_bkdwn_mod_mat
In [ ]:
plt.plot(e_bkdwn_mod_mat/1e6)
plt.legend(e_bkdwn_mod_mat.columns)
plt.title('PERC MFGing energy Demands by component')
plt.ylabel('Manufacturing Energy [MWh/module]')
In [ ]:
energy_mat_anModule_shj_glass = energy_mat_anModule.filter(like='SHJ').filter(like='glass')
energy_mat_anModule_shj_si = energy_mat_anModule.filter(like='SHJ').filter(like='silicon')
energy_mat_anModule_shj_ag = energy_mat_anModule.filter(like='SHJ').filter(like='silver')

energy_anModule_shj_mod_temp = energy_anModule.filter(like='SHJ')
remove_1 = energy_anModule.filter(like='SHJ').filter(like='e_out').columns
energy_anModule_shj_mod = energy_anModule_shj_mod_temp.drop(columns=remove_1)
In [ ]:
emod_shj = energy_anModule_shj_mod.sum(axis=1)
eglass_shj = energy_mat_anModule_shj_glass.sum(axis=1)
esi_shj = energy_mat_anModule_shj_si.sum(axis=1)
eag_shj = energy_mat_anModule_shj_ag.sum(axis=1)
e_bkdwn_mod_mat_shj = pd.concat([emod_shj,eglass_shj,esi_shj,eag_shj], axis=1, keys=['module','glass','silicon','silver'])
idx_20_50 = pd.Series(range(2020,2051))
e_bkdwn_mod_mat_shj.index=idx_20_50
In [ ]:
e_bkdwn_mod_mat_shj
In [ ]:
fig, ax = plt.subplots()

ax.bar(e_bkdwn_mod_mat_shj.index, e_bkdwn_mod_mat_shj['module']/1e6, label='module', color='slategray')
ax.bar(e_bkdwn_mod_mat_shj.index, e_bkdwn_mod_mat_shj['glass']/1e6, label='glass', color = 'lightskyblue',
       bottom=e_bkdwn_mod_mat_shj['module']/1e6)
ax.bar(e_bkdwn_mod_mat_shj.index, e_bkdwn_mod_mat_shj['silicon']/1e6, label='silicon', color='cornflowerblue',
       bottom=(e_bkdwn_mod_mat_shj['module']+e_bkdwn_mod_mat_shj['glass'])/1e6)
ax.bar(e_bkdwn_mod_mat_shj.index, e_bkdwn_mod_mat_shj['silver']/1e6, label='silver', color = 'navy',
       bottom=(e_bkdwn_mod_mat_shj['module']+e_bkdwn_mod_mat_shj['glass']+e_bkdwn_mod_mat_shj['silicon'])/1e6)

plt.legend(loc='lower center')
ax.set_ylabel('Energy Demand [MWh/module]')
plt.title('Change in Manufacturing Energy by Component: SHJ')
plt.rc('font', size=14) #controls default text size
plt.show()
In [ ]:
 
In [ ]:
 
In [ ]:
# create an agg Energy Results based on agg mass results
    def aggregateResults_e(self, scenarios=None, materials=None):

        if scenarios is None:
            scenarios = list(self.scenario.keys())
        else:
            if isinstance(scenarios, str):
                scenarios = [scenarios]

        if materials is None:
            materials = list(self.scenario[scenarios[0]].material.keys())
        else:
            if isinstance(materials, str):
                materials = [materials]

        keywds = ['mat_Virgin_Stock', 'mat_Total_Landfilled', 'mat_Total_EOL_Landfilled', 'mat_Total_MFG_Landfilled']
        nice_keywds = ['VirginStock', 'WasteAll', 'WasteEOL', 'WasteMFG']

        USyearly=pd.DataFrame()

        for scen in scenarios:
            for ii in range(len(keywds)):
                keywd = keywds[ii]
                nicekey = nice_keywds[ii]

                for mat in materials:
                    USyearly[nicekey+'_'+mat+'_'+self.name+'_'+scen] = self.scenario[scen].material[mat].matdataOut_m[keywd]
                filter_col = [col for col in USyearly if (col.startswith(nicekey) and col.endswith(self.name+'_'+scen)) ]
                USyearly[nicekey+'_Module_'+self.name+'_'+scen] = USyearly[filter_col].sum(axis=1)
                # 2DO: Add multiple objects option


        USyearly = USyearly/1000000  # This is the ratio for grams to Metric tonnes
        USyearly = USyearly.add_suffix('_[Tonnes]')

        # Different units, so no need to do the ratio to Metric tonnes :p
        keywd1='new_Installed_Capacity_[MW]'

        for scen in scenarios:
            USyearly['newInstalledCapacity_'+self.name+'_'+scen+'_[MW]'] = self.scenario[scen].dataIn_m[keywd1]

        # Creating c umulative results
        UScum = USyearly.copy()
        UScum = UScum.cumsum()

        # Adding Installed Capacity to US (This is already 'Cumulative') so not including it in UScum
        # We are also renaming it to 'ActiveCapacity' and calculating Decommisioned Capacity.
        # TODO: Rename Installed_CApacity to ActiveCapacity throughout.
        keywd='Installed_Capacity_[W]'
        for scen in scenarios:
            USyearly['ActiveCapacity_'+self.name+'_'+scen+'_[MW]'] = self.scenario[scen].dataOut_m[keywd]/1e6
            USyearly['DecommisionedCapacity_'+self.name+'_'+scen+'_[MW]'] = (
                UScum['newInstalledCapacity_'+self.name+'_'+scen+'_[MW]']-
                USyearly['ActiveCapacity_'+self.name+'_'+scen+'_[MW]'])

        # Adding Decommissioned Capacity

        # Reindexing and Merging
        USyearly.index = self.scenario[scen].dataIn_m['year']
        UScum.index = self.scenario[scen].dataIn_m['year']

        self.USyearly = USyearly
        self.UScum = UScum

        return USyearly, UScum